Kodexempel
Engångskoder - .NET - Managed
String ACCESS_USERNAME = "accessusername";
String ACCESS_PASSWORD = "accesspassword";
// Get from form
String username = "myuser";
String password = "mypass";
String otp = "123456";
AuthenticatorCredential c = new AuthenticatorCredential();
c.setUsername( ACCESS_USERNAME );
c.setPassword( ACCESS_PASSWORD );
Attempt a = new Attempt();
a.setUsername( username );
a.setOTP( otp );
SimpleAssertion sa = validateOTP(c, a);
if (true.Equals(sa.isAuthenticated())) {
// FEDLOGIN SUCCESS
/* if ( localAuthenticationMechanismValidates( username, password ) ) {
* // SUCCESS
* } else {
* // FAILURE
* }
*/
} else {
// FEDLOGIN FAILED
Console.write("Authentication failed: " + sa.getMessage());
Console.write("Status: " + sa.getStatus());
}




