Class OpenIdAuthenticator
- All Implemented Interfaces:
org.eclipse.jetty.security.Authenticator
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 path set by setRedirectPath(String) 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/interfaces inherited from class org.eclipse.jetty.security.authentication.LoginAuthenticator
org.eclipse.jetty.security.authentication.LoginAuthenticator.LoggedOutAuthentication, org.eclipse.jetty.security.authentication.LoginAuthenticator.UserAuthenticationSent, org.eclipse.jetty.security.authentication.LoginAuthenticator.UserAuthenticationSucceededNested classes/interfaces inherited from interface org.eclipse.jetty.security.Authenticator
org.eclipse.jetty.security.Authenticator.Configuration, org.eclipse.jetty.security.Authenticator.Factory, org.eclipse.jetty.security.Authenticator.NoOp -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringDeprecated.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.eclipse.jetty.security.authentication.LoginAuthenticator
_identityService, _loginServiceFields inherited from interface org.eclipse.jetty.security.Authenticator
BASIC_AUTH, CERT_AUTH, CERT_AUTH2, DIGEST_AUTH, FORM_AUTH, NEGOTIATE_AUTH, OPENID_AUTH, SPNEGO_AUTH -
Constructor Summary
ConstructorsConstructorDescriptionOpenIdAuthenticator(OpenIdConfiguration configuration) OpenIdAuthenticator(OpenIdConfiguration configuration, String errorPage) OpenIdAuthenticator(OpenIdConfiguration configuration, String redirectPath, String errorPage) OpenIdAuthenticator(OpenIdConfiguration configuration, String redirectPath, String errorPage, String logoutRedirectPath) -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetChallengeUri(org.eclipse.jetty.server.Request request) org.eclipse.jetty.security.Constraint.AuthorizationgetConstraintAuthentication(String pathInContext, org.eclipse.jetty.security.Constraint.Authorization existing, Function<Boolean, org.eclipse.jetty.server.Session> getSession) protected org.eclipse.jetty.util.FieldsgetParameters(org.eclipse.jetty.server.Request request) booleanDeprecated.booleanisErrorPage(String pathInContext) booleanisJSecurityCheck(String uri) org.eclipse.jetty.security.UserIdentitylogin(String username, Object credentials, org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response) voidlogout(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response) org.eclipse.jetty.server.RequestprepareRequest(org.eclipse.jetty.server.Request request, org.eclipse.jetty.security.AuthenticationState authenticationState) voidsetAlwaysSaveUri(boolean alwaysSave) Deprecated.voidsetConfiguration(org.eclipse.jetty.security.Authenticator.Configuration authConfig) voidsetErrorPage(String path) voidsetLogoutRedirectPath(String logoutRedirectPath) voidsetRedirectPath(String redirectPath) org.eclipse.jetty.security.AuthenticationStatevalidateRequest(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, org.eclipse.jetty.util.Callback cb) Methods inherited from class org.eclipse.jetty.security.authentication.LoginAuthenticator
getLoginService, updateSession
-
Field Details
-
CLAIMS
- See Also:
-
RESPONSE
- See Also:
-
ISSUER
- See Also:
-
REDIRECT_PATH
- See Also:
-
LOGOUT_REDIRECT_PATH
- See Also:
-
ERROR_PAGE
- See Also:
-
J_URI
- See Also:
-
J_POST
- See Also:
-
J_METHOD
- See Also:
-
J_SECURITY_CHECK
- See Also:
-
ERROR_PARAMETER
- See Also:
-
CSRF_TOKEN
Deprecated.- See Also:
-
-
Constructor Details
-
OpenIdAuthenticator
public OpenIdAuthenticator() -
OpenIdAuthenticator
-
OpenIdAuthenticator
-
OpenIdAuthenticator
public OpenIdAuthenticator(OpenIdConfiguration configuration, String redirectPath, String errorPage) -
OpenIdAuthenticator
public OpenIdAuthenticator(OpenIdConfiguration configuration, String redirectPath, String errorPage, String logoutRedirectPath)
-
-
Method Details
-
setConfiguration
public void setConfiguration(org.eclipse.jetty.security.Authenticator.Configuration authConfig) - Specified by:
setConfigurationin interfaceorg.eclipse.jetty.security.Authenticator- Overrides:
setConfigurationin classorg.eclipse.jetty.security.authentication.LoginAuthenticator
-
getAuthenticationType
-
setAlwaysSaveUri
Deprecated. -
isAlwaysSaveUri
Deprecated. -
setRedirectPath
-
setLogoutRedirectPath
-
setErrorPage
-
login
public org.eclipse.jetty.security.UserIdentity login(String username, Object credentials, org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response) - Overrides:
loginin classorg.eclipse.jetty.security.authentication.LoginAuthenticator
-
logout
public void logout(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response) - Overrides:
logoutin classorg.eclipse.jetty.security.authentication.LoginAuthenticator
-
prepareRequest
public org.eclipse.jetty.server.Request prepareRequest(org.eclipse.jetty.server.Request request, org.eclipse.jetty.security.AuthenticationState authenticationState) -
getParameters
protected org.eclipse.jetty.util.Fields getParameters(org.eclipse.jetty.server.Request request) -
getConstraintAuthentication
-
validateRequest
public org.eclipse.jetty.security.AuthenticationState validateRequest(org.eclipse.jetty.server.Request request, org.eclipse.jetty.server.Response response, org.eclipse.jetty.util.Callback cb) throws org.eclipse.jetty.security.ServerAuthException - Throws:
org.eclipse.jetty.security.ServerAuthException
-
isJSecurityCheck
-
isErrorPage
-
getChallengeUri
-