Class OpenIdAuthenticator
- java.lang.Object
-
- org.eclipse.jetty.security.authentication.LoginAuthenticator
-
- org.eclipse.jetty.security.openid.OpenIdAuthenticator
-
- All Implemented Interfaces:
org.eclipse.jetty.security.Authenticator
public class OpenIdAuthenticator extends org.eclipse.jetty.security.authentication.LoginAuthenticatorImplements 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
OpenIdCredentialsandOpenIdLoginService.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 attributeRESPONSE.SessionAuthenticationis 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 classOpenIdAuthenticator.OpenIdAuthenticationThis Authentication represents a just completed OpenId Connect authentication.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCLAIMSstatic java.lang.StringCSRF_TOKENDeprecated.static java.lang.StringERROR_PAGEstatic java.lang.StringERROR_PARAMETERstatic java.lang.StringJ_METHODstatic java.lang.StringJ_POSTstatic java.lang.StringJ_SECURITY_CHECKstatic java.lang.StringJ_URIstatic java.lang.StringRESPONSE
-
Constructor Summary
Constructors Constructor Description OpenIdAuthenticator()OpenIdAuthenticator(OpenIdConfiguration configuration, java.lang.String errorPage)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetAuthMethod()protected java.lang.StringgetChallengeUri(org.eclipse.jetty.server.Request request)booleanisAlwaysSaveUri()Deprecated.booleanisErrorPage(java.lang.String pathInContext)booleanisJSecurityCheck(java.lang.String uri)org.eclipse.jetty.server.UserIdentitylogin(java.lang.String username, java.lang.Object credentials, javax.servlet.ServletRequest request)voidlogout(javax.servlet.ServletRequest request)voidprepareRequest(javax.servlet.ServletRequest request)booleansecureResponse(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, boolean mandatory, org.eclipse.jetty.server.Authentication.User validatedUser)voidsetAlwaysSaveUri(boolean alwaysSave)Deprecated.voidsetConfiguration(org.eclipse.jetty.security.Authenticator.AuthConfiguration configuration)org.eclipse.jetty.server.AuthenticationvalidateRequest(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, boolean mandatory)
-
-
-
Field Detail
-
CLAIMS
public static final java.lang.String CLAIMS
- See Also:
- Constant Field Values
-
RESPONSE
public static final java.lang.String RESPONSE
- See Also:
- Constant Field Values
-
ERROR_PAGE
public static final java.lang.String ERROR_PAGE
- See Also:
- Constant Field Values
-
J_URI
public static final java.lang.String J_URI
- See Also:
- Constant Field Values
-
J_POST
public static final java.lang.String J_POST
- See Also:
- Constant Field Values
-
J_METHOD
public static final java.lang.String J_METHOD
- See Also:
- Constant Field Values
-
J_SECURITY_CHECK
public static final java.lang.String J_SECURITY_CHECK
- See Also:
- Constant Field Values
-
ERROR_PARAMETER
public static final java.lang.String ERROR_PARAMETER
- See Also:
- Constant Field Values
-
CSRF_TOKEN
@Deprecated public static final java.lang.String CSRF_TOKEN
Deprecated.- See Also:
- Constant Field Values
-
-
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:
setConfigurationin interfaceorg.eclipse.jetty.security.Authenticator- Overrides:
setConfigurationin classorg.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:
loginin classorg.eclipse.jetty.security.authentication.LoginAuthenticator
-
logout
public void logout(javax.servlet.ServletRequest request)
- Overrides:
logoutin classorg.eclipse.jetty.security.authentication.LoginAuthenticator
-
prepareRequest
public void prepareRequest(javax.servlet.ServletRequest request)
- Specified by:
prepareRequestin interfaceorg.eclipse.jetty.security.Authenticator- Overrides:
prepareRequestin classorg.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)
-
-