use of net.phonefactor.pfsdk.PFAuthResult in project cas by apereo.
the class AzureAuthenticatorAuthenticationHandler method doAuthentication.
@Override
protected HandlerResult doAuthentication(final Credential credential) throws GeneralSecurityException, PreventedException {
try {
final AzureAuthenticatorTokenCredential c = (AzureAuthenticatorTokenCredential) credential;
final RequestContext context = RequestContextHolder.getRequestContext();
final Principal principal = WebUtils.getAuthentication(context).getPrincipal();
LOGGER.debug("Received principal id [{}]", principal.getId());
final PFAuthParams params = authenticationRequestBuilder.build(principal, c);
final PFAuthResult r = azureAuthenticatorInstance.authenticate(params);
if (r.getAuthenticated()) {
return createHandlerResult(c, principalFactory.createPrincipal(principal.getId()), null);
}
LOGGER.error("Authentication failed. Call status: [{}]-[{}]. Error: [{}]", r.getCallStatus(), r.getCallStatusString(), r.getMessageError());
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
throw new FailedLoginException("Failed to authenticate user");
}
Aggregations