Search in sources :

Example 1 with AuthenticationResult

use of org.onebusaway.everylastlogin.server.AuthenticationResult in project onebusaway-application-modules by camsys.

the class EveryLastLoginAuthenticationProcessorFilter method attemptAuthentication.

@Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
    String mode = request.getParameter("mode");
    AuthenticationResult result = LoginManager.getResult(request);
    if (result == null)
        throw new EveryLastLoginAuthenticationException("AuthenticationResult not found", mode);
    if (result.getCode() != EResultCode.SUCCESS)
        throw new EveryLastLoginAuthenticationException("AuthenticationResult failure", mode);
    IndexedUserDetails details = _currentUserService.handleUserAction(result.getProvider(), result.getIdentity(), result.getCredentials(), false, mode);
    if (details == null)
        throw new EveryLastLoginAuthenticationException("could not get user details", mode);
    return new DefaultUserAuthenticationToken(details);
}
Also used : IndexedUserDetails(org.onebusaway.users.model.IndexedUserDetails) AuthenticationResult(org.onebusaway.everylastlogin.server.AuthenticationResult)

Aggregations

AuthenticationResult (org.onebusaway.everylastlogin.server.AuthenticationResult)1 IndexedUserDetails (org.onebusaway.users.model.IndexedUserDetails)1