@Override
    public AuthenticationHandlerExecutionResult authenticate(final Credential credential, final Service service) throws Throwable {
        val otp = (OneTimePasswordCredential) credential;
        val valueOnRecord = credentialMap.get(otp.getId());
        if (otp.getPassword().equals(valueOnRecord)) {
            return new DefaultAuthenticationHandlerExecutionResult(this, otp, getPrincipalFactory().createPrincipal(otp.getId()));
        }
        throw new FailedLoginException();
    }
Test one-time password authentication handler.

@author Marvin S. Addison
@since 4.0.0
core/cas-server-core-authentication/src/test/java/org/apereo/cas/TestOneTimePasswordAuthenticationHandler.java