Class OpenIdAuthenticator

  • All Implemented Interfaces:
    Authenticator

    public class OpenIdAuthenticator
    extends LoginAuthenticator

    Implements authentication using OpenId Connect on top of OAuth 2.0.

    The OpenIdAuthenticator redirects unauthenticated requests to the OpenID Connect Provider. The End-User is eventually redirected back with an Authorization Code to the /j_security_check URI within the context. The Authorization Code is then used to authenticate the user through the OpenIdCredentials and OpenIdLoginService.

    Once a user is authenticated the OpenID Claims can be retrieved through an attribute on the session with the key CLAIMS. The full response containing the OAuth 2.0 Access Token can be obtained with the session attribute RESPONSE.

    SessionAuthentication is then used to wrap Authentication results so that they are associated with the session.

    • Constructor Detail

      • OpenIdAuthenticator

        public OpenIdAuthenticator()
      • OpenIdAuthenticator

        public OpenIdAuthenticator​(OpenIdConfiguration configuration,
                                   java.lang.String errorPage)
    • Method Detail

      • getAuthMethod

        public java.lang.String getAuthMethod()
      • setAlwaysSaveUri

        public void setAlwaysSaveUri​(boolean alwaysSave)
        If true, uris that cause a redirect to a login page will always be remembered. If false, only the first uri that leads to a login page redirect is remembered.
        Parameters:
        alwaysSave - true to always save the uri
      • isAlwaysSaveUri

        public boolean isAlwaysSaveUri()
      • login

        public UserIdentity login​(java.lang.String username,
                                  java.lang.Object credentials,
                                  javax.servlet.ServletRequest request)
        Overrides:
        login in class LoginAuthenticator
      • isJSecurityCheck

        public boolean isJSecurityCheck​(java.lang.String uri)
      • isErrorPage

        public boolean isErrorPage​(java.lang.String pathInContext)
      • getChallengeUri

        protected java.lang.String getChallengeUri​(javax.servlet.http.HttpServletRequest request)
      • secureResponse

        public boolean secureResponse​(javax.servlet.ServletRequest req,
                                      javax.servlet.ServletResponse res,
                                      boolean mandatory,
                                      Authentication.User validatedUser)