Class OpenIdAuthenticator

  • All Implemented Interfaces:
    org.eclipse.jetty.security.Authenticator

    public class OpenIdAuthenticator
    extends org.eclipse.jetty.security.authentication.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.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  OpenIdAuthenticator.OpenIdAuthentication
      This Authentication represents a just completed OpenId Connect authentication.
      • Nested classes/interfaces inherited from interface org.eclipse.jetty.security.Authenticator

        org.eclipse.jetty.security.Authenticator.AuthConfiguration, org.eclipse.jetty.security.Authenticator.Factory
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String CLAIMS  
      static java.lang.String CSRF_TOKEN
      Deprecated.
      static java.lang.String ERROR_PAGE  
      static java.lang.String ERROR_PARAMETER  
      static java.lang.String J_METHOD  
      static java.lang.String J_POST  
      static java.lang.String J_SECURITY_CHECK  
      static java.lang.String J_URI  
      static java.lang.String RESPONSE  
      • Fields inherited from class org.eclipse.jetty.security.authentication.LoginAuthenticator

        _identityService, _loginService
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.String getAuthMethod()  
      protected java.lang.String getChallengeUri​(org.eclipse.jetty.server.Request request)  
      boolean isAlwaysSaveUri()
      Deprecated.
      boolean isErrorPage​(java.lang.String pathInContext)  
      boolean isJSecurityCheck​(java.lang.String uri)  
      org.eclipse.jetty.server.UserIdentity login​(java.lang.String username, java.lang.Object credentials, javax.servlet.ServletRequest request)  
      void logout​(javax.servlet.ServletRequest request)  
      void prepareRequest​(javax.servlet.ServletRequest request)  
      boolean secureResponse​(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, boolean mandatory, org.eclipse.jetty.server.Authentication.User validatedUser)  
      void setAlwaysSaveUri​(boolean alwaysSave)
      Deprecated.
      void setConfiguration​(org.eclipse.jetty.security.Authenticator.AuthConfiguration configuration)  
      org.eclipse.jetty.server.Authentication validateRequest​(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, boolean mandatory)  
      • Methods inherited from class org.eclipse.jetty.security.authentication.LoginAuthenticator

        getLoginService, renewSession
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpenIdAuthenticator

        public OpenIdAuthenticator()
      • OpenIdAuthenticator

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

      • setConfiguration

        public void setConfiguration​(org.eclipse.jetty.security.Authenticator.AuthConfiguration configuration)
        Specified by:
        setConfiguration in interface org.eclipse.jetty.security.Authenticator
        Overrides:
        setConfiguration in class org.eclipse.jetty.security.authentication.LoginAuthenticator
      • getAuthMethod

        public java.lang.String getAuthMethod()
      • setAlwaysSaveUri

        @Deprecated
        public void setAlwaysSaveUri​(boolean alwaysSave)
        Deprecated.
      • isAlwaysSaveUri

        @Deprecated
        public boolean isAlwaysSaveUri()
        Deprecated.
      • login

        public org.eclipse.jetty.server.UserIdentity login​(java.lang.String username,
                                                           java.lang.Object credentials,
                                                           javax.servlet.ServletRequest request)
        Overrides:
        login in class org.eclipse.jetty.security.authentication.LoginAuthenticator
      • logout

        public void logout​(javax.servlet.ServletRequest request)
        Overrides:
        logout in class org.eclipse.jetty.security.authentication.LoginAuthenticator
      • prepareRequest

        public void prepareRequest​(javax.servlet.ServletRequest request)
        Specified by:
        prepareRequest in interface org.eclipse.jetty.security.Authenticator
        Overrides:
        prepareRequest in class org.eclipse.jetty.security.authentication.LoginAuthenticator
      • validateRequest

        public org.eclipse.jetty.server.Authentication validateRequest​(javax.servlet.ServletRequest req,
                                                                       javax.servlet.ServletResponse res,
                                                                       boolean mandatory)
                                                                throws org.eclipse.jetty.security.ServerAuthException
        Throws:
        org.eclipse.jetty.security.ServerAuthException
      • isJSecurityCheck

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

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

        protected java.lang.String getChallengeUri​(org.eclipse.jetty.server.Request request)
      • secureResponse

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