Class AbstractPac4jAuthenticationHandler

  • All Implemented Interfaces:
    org.apereo.cas.authentication.AuthenticationHandler, org.apereo.cas.authentication.PrePostAuthenticationHandler, org.springframework.core.Ordered
    Direct Known Subclasses:
    AbstractWrapperAuthenticationHandler

    public abstract class AbstractPac4jAuthenticationHandler
    extends org.apereo.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler
    Abstract pac4j authentication handler which builds the CAS handler result from the pac4j user profile.
    Since:
    4.1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.pac4j.core.context.session.SessionStore sessionStore
      The session store.
      • Fields inherited from class org.apereo.cas.authentication.AbstractAuthenticationHandler

        principalFactory
      • Fields inherited from interface org.apereo.cas.authentication.AuthenticationHandler

        SUCCESSFUL_AUTHENTICATION_HANDLERS
      • Fields inherited from interface org.springframework.core.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractPac4jAuthenticationHandler​(java.lang.String name, org.apereo.cas.services.ServicesManager servicesManager, org.apereo.cas.authentication.principal.PrincipalFactory principalFactory, java.lang.Integer order, org.pac4j.core.context.session.SessionStore sessionStore)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResult createResult​(org.apereo.cas.authentication.principal.ClientCredential credentials, org.pac4j.core.profile.UserProfile profile, org.pac4j.core.client.BaseClient client)
      Build the handler result.
      protected java.lang.String determinePrincipalIdFrom​(org.pac4j.core.profile.UserProfile profile, org.pac4j.core.client.BaseClient client)
      Determine principal id from profile.
      protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResult finalizeAuthenticationHandlerResult​(org.apereo.cas.authentication.principal.ClientCredential credentials, org.apereo.cas.authentication.principal.Principal principal, org.pac4j.core.profile.UserProfile profile, org.pac4j.core.client.BaseClient client)
      Finalize authentication handler result.
      protected void preFinalizeAuthenticationHandlerResult​(org.apereo.cas.authentication.principal.ClientCredential credentials, org.apereo.cas.authentication.principal.Principal principal, org.pac4j.core.profile.UserProfile profile, org.pac4j.core.client.BaseClient client)
      Pre finalize authentication handler result.
      protected void storeUserProfile​(org.pac4j.core.context.WebContext webContext, org.pac4j.core.profile.UserProfile profile)
      Store user profile.
      • Methods inherited from class org.apereo.cas.authentication.handler.support.AbstractPreAndPostProcessingAuthenticationHandler

        authenticate, createHandlerResult, createHandlerResult, doAuthentication
      • Methods inherited from class org.apereo.cas.authentication.AbstractAuthenticationHandler

        canEqual, equals, getCredentialSelectionPredicate, getName, getOrder, getPrincipalFactory, getServicesManager, getState, hashCode, setCredentialSelectionPredicate, setState
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.apereo.cas.authentication.AuthenticationHandler

        getName, getOrder, getState, supports, supports
      • Methods inherited from interface org.apereo.cas.authentication.PrePostAuthenticationHandler

        postAuthenticate, preAuthenticate
    • Field Detail

      • sessionStore

        protected final org.pac4j.core.context.session.SessionStore sessionStore
        The session store.
    • Constructor Detail

      • AbstractPac4jAuthenticationHandler

        protected AbstractPac4jAuthenticationHandler​(java.lang.String name,
                                                     org.apereo.cas.services.ServicesManager servicesManager,
                                                     org.apereo.cas.authentication.principal.PrincipalFactory principalFactory,
                                                     java.lang.Integer order,
                                                     org.pac4j.core.context.session.SessionStore sessionStore)
    • Method Detail

      • createResult

        protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResult createResult​(org.apereo.cas.authentication.principal.ClientCredential credentials,
                                                                                                  org.pac4j.core.profile.UserProfile profile,
                                                                                                  org.pac4j.core.client.BaseClient client)
                                                                                           throws java.security.GeneralSecurityException
        Build the handler result.
        Parameters:
        credentials - the provided credentials
        profile - the retrieved user profile
        client - the client
        Returns:
        the built handler result
        Throws:
        java.security.GeneralSecurityException - On authentication failure.
      • finalizeAuthenticationHandlerResult

        protected org.apereo.cas.authentication.AuthenticationHandlerExecutionResult finalizeAuthenticationHandlerResult​(org.apereo.cas.authentication.principal.ClientCredential credentials,
                                                                                                                         org.apereo.cas.authentication.principal.Principal principal,
                                                                                                                         org.pac4j.core.profile.UserProfile profile,
                                                                                                                         org.pac4j.core.client.BaseClient client)
        Finalize authentication handler result.
        Parameters:
        credentials - the credentials
        principal - the principal
        profile - the profile
        client - the client
        Returns:
        the authentication handler execution result
      • preFinalizeAuthenticationHandlerResult

        protected void preFinalizeAuthenticationHandlerResult​(org.apereo.cas.authentication.principal.ClientCredential credentials,
                                                              org.apereo.cas.authentication.principal.Principal principal,
                                                              org.pac4j.core.profile.UserProfile profile,
                                                              org.pac4j.core.client.BaseClient client)
        Pre finalize authentication handler result.
        Parameters:
        credentials - the credentials
        principal - the principal
        profile - the profile
        client - the client
      • determinePrincipalIdFrom

        protected java.lang.String determinePrincipalIdFrom​(org.pac4j.core.profile.UserProfile profile,
                                                            org.pac4j.core.client.BaseClient client)
        Determine principal id from profile.
        Parameters:
        profile - the profile
        client - the client
        Returns:
        the id
      • storeUserProfile

        protected void storeUserProfile​(org.pac4j.core.context.WebContext webContext,
                                        org.pac4j.core.profile.UserProfile profile)
        Store user profile.
        Parameters:
        webContext - the web context
        profile - the profile