Kodexempel
Engångskoder - Ruby - Managed
/** * Project: Fedlogin: a Ruby library inteface to the Fedlogin authentication service * * * --- ABOUT THIS FILE ------------------------ * * This library is used for accessing authentication services * such as one-time-passwords, challenge-response mechanisms * and signature services. * * Note: this library is used for Fedlogin MANAGED authentication services. * As such, users and tokens are managed by Fedlogin. Customers do not need * to manage tokens. * * There is also a library available for Fedlogin UNMANAGED services, * where each customer manages token data. In this scenario, * Fedlogin does not manage users - it only provides the authentication mechanism. * * * --- USAGE SCENARIOS ------------------------ * * - Use ONE-TIME-PASSWORDS when authenticating a logon. * * - Use CHALLENGE-RESPONSE when authenticating a logon in a scenario * where stronger authentication is needed. * * - Use SIGNATURE when a need for a legally binding electronic signature * is needed, such as in a payment scenario. * Example: signing the order# or the total amount paid. * * * --- AVAILABLE METHODS ------------------------ * * - validateOTP: Validates a One-Time-Password * Token(s) supported: GO3, DP260, Digipass for Java Phone * Note: A OTP is ALWAYS six digits long. * * - requestChallenge: Requests a Challenge for a challenge-response sequence * Token(s) supported: DP260, Digipass for Java Phone * Note: A challenge is ALWAYS eight digits long. * * - validateChallengeResponse: Validates a challenge-response sequence * Token(s) supported: DP260, Digipass for Java Phone * Note: A response to a Challenge is ALWAYS six digits long. * * - validateSignature: Validates a signature sequence * Token(s) supported: DP260, Digipass for Java Phone * Note: Two signature fields must ALWAYS be used. * Note: Each signature field is ALWAYS eleven digits long. * Note: A token signature is ALWAYS six digits long. * * * --- GETTING STARTED ------------------------ * * 1. Edit the _ACCESS_USERNAME and _ACCESS_PASSWORD parameters accordingly. * 2. Take a look at some of the sample authentication calls below. * * Note: For a list of status messages, see https://ws.fedlogin.net/status.txt. * * * @link http://www.fedlogin.com * @copyright 2008 Fedlogin Security AB * @author Ulf Sahlin* @package Fedlogin * @version 1.0 */ require 'soap/wsdlDriver' class FedloginWrapper @@adminName = _ACCESS_USERNAME @@adminPasswd = _ACCESS_PASSWORD @@wsdl_uri = 'https://ws.fedlogin.net/Authenticator.asmx?WSDL' def self.validateOTP(username, otp) soap = SOAP::WSDLDriverFactory.new(@@wsdl_uri).create_rpc_driver response = soap.validateOTPRaw( :adminName => @@adminName, :adminPasswd => @@adminPasswd, :username => username, :otp => otp ) response.validateOTPRawResult.validated == "true" end end




