Search in sources :

Example 6 with GoogleAuthenticatorTokenCredential

use of org.apereo.cas.gauth.credential.GoogleAuthenticatorTokenCredential in project cas by apereo.

the class GoogleAuthenticatorAuthenticationHandlerTests method getGoogleAuthenticatorTokenCredential.

private GoogleAuthenticatorTokenCredential getGoogleAuthenticatorTokenCredential() {
    val credential = new GoogleAuthenticatorTokenCredential();
    account = googleAuthenticator.createCredentials("casuser");
    val key = googleAuthenticator.getTotpPassword(account.getKey());
    credential.setToken(Integer.toString(key));
    return credential;
}
Also used : lombok.val(lombok.val) GoogleAuthenticatorTokenCredential(org.apereo.cas.gauth.credential.GoogleAuthenticatorTokenCredential)

Aggregations

lombok.val (lombok.val)6 GoogleAuthenticatorTokenCredential (org.apereo.cas.gauth.credential.GoogleAuthenticatorTokenCredential)6 Test (org.junit.jupiter.api.Test)3 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2 ArrayList (java.util.ArrayList)1 FailedLoginException (javax.security.auth.login.FailedLoginException)1 DefaultMessageContext (org.springframework.binding.message.DefaultMessageContext)1 MessageSource (org.springframework.context.MessageSource)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1 MockServletContext (org.springframework.mock.web.MockServletContext)1 LinkedMultiValueMap (org.springframework.util.LinkedMultiValueMap)1 ServletExternalContext (org.springframework.webflow.context.servlet.ServletExternalContext)1 MockRequestContext (org.springframework.webflow.test.MockRequestContext)1