Search in sources :

Example 1 with UserInfoAdapter

use of com.enonic.app.auth0.impl.user.UserInfoAdapter in project app-auth0-idprovider by enonic.

the class Auth0CallbackService method handle.

public boolean handle(final HttpServletRequest request) {
    try {
        final IdProviderKey idProviderKey = getIdProviderKey(request);
        final AuthenticationController authController = createAuthController(idProviderKey);
        final Tokens tokens = authController.handle(request);
        final UserInfo userInfo = retrieveUserInfo(idProviderKey, tokens);
        loginService.login(request, new UserInfoAdapter(userInfo), idProviderKey);
        return true;
    } catch (Exception e) {
        LOG.error("Error while handling auth0 callback", e);
    }
    return false;
}
Also used : AuthenticationController(com.auth0.AuthenticationController) IdProviderKey(com.enonic.xp.security.IdProviderKey) UserInfo(com.auth0.json.auth.UserInfo) UserInfoAdapter(com.enonic.app.auth0.impl.user.UserInfoAdapter) Auth0Exception(com.auth0.exception.Auth0Exception) Tokens(com.auth0.Tokens)

Aggregations

AuthenticationController (com.auth0.AuthenticationController)1 Tokens (com.auth0.Tokens)1 Auth0Exception (com.auth0.exception.Auth0Exception)1 UserInfo (com.auth0.json.auth.UserInfo)1 UserInfoAdapter (com.enonic.app.auth0.impl.user.UserInfoAdapter)1 IdProviderKey (com.enonic.xp.security.IdProviderKey)1