Kodexempel
Engångskoder - Java - Managed
String ACCESS_USERNAME = "accessusername";
String ACCESS_PASSWORD = "accesspassword";
String username = "myuser"; // Get from form
String password = "mypass"; // Get from form
String otp = "123456"; // Get from form
Authenticator au = new Authenticator();
AuthenticatorSoap auth = au.getAuthenticatorSoap();
AuthenticatorCredential c = new AuthenticatorCredential();
c.setUsername( ACCESS_USERNAME );
c.setPassword( ACCESS_PASSWORD );
Attempt a = new Attempt();
a.setUsername( username );
a.setOtp( otp );
SimpleAssertion sa = auth.validateOTP( c, a );
System.out.println("RESULT: " + sa.isValidated());
if ( true.equals( sa.isValidated() ) {
// Fedlogin success -> Verify local static password
/* if ( localAuthenticationMechanismValidates( username, password ) ) {
* // SUCCESS
* } else {
* // FAILURE
* }
*/
} else {
// Fedlogin failed
System.out.println("FAILED -> status: " + sa.getStatus() + ", message: " + sa.getMessage());
}




