Class LoginAuthenticator
java.lang.Object
org.eclipse.jetty.ee8.security.authentication.LoginAuthenticator
- All Implemented Interfaces:
 Authenticator
- Direct Known Subclasses:
 BasicAuthenticator, ConfigurableSpnegoAuthenticator, DigestAuthenticator, FormAuthenticator, JaspiAuthenticator, OpenIdAuthenticator, SslClientCertAuthenticator
- 
Nested Class Summary
Nested classes/interfaces inherited from interface Authenticator
Authenticator.AuthConfiguration, Authenticator.Factory - 
Field Summary
FieldsFields inherited from interface Authenticator
BASIC_AUTH, CERT_AUTH, CERT_AUTH2, DIGEST_AUTH, FORM_AUTH, NEGOTIATE_AUTH, OPENID_AUTH, SPNEGO_AUTH - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionintbooleanIf the UserIdentity returned fromLoginService.login(String, Object, org.eclipse.jetty.server.Request, Function)is not null, it is assumed that the user is fully authenticated and we need to change the session id to prevent session fixation vulnerability.voidlogout(javax.servlet.ServletRequest request) voidprepareRequest(javax.servlet.ServletRequest request) Called prior to validateRequest.protected javax.servlet.http.HttpSessionrenewSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Change the session id.voidsetConfiguration(Authenticator.AuthConfiguration configuration) Configure the AuthenticatorvoidsetProxyMode(boolean proxy) Sets the authenticator to operate in proxy authentication mode.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Authenticator
getAuthMethod, secureResponse, validateRequest 
- 
Field Details
- 
_loginService
 - 
_identityService
 
 - 
 - 
Constructor Details
- 
LoginAuthenticator
protected LoginAuthenticator() 
 - 
 - 
Method Details
- 
isProxyMode
public boolean isProxyMode()- Returns:
 - true if this authenticator is in proxy mode.
 - See Also:
 
 - 
setProxyMode
public void setProxyMode(boolean proxy) Sets the authenticator to operate in proxy authentication mode.When set to
true, this mode changes the behavior of the authentication helpers:getChallengeHeader()will returnProxy-Authenticate.getUnauthorizedStatusCode()will return407.getAuthorizationHeader()will return theProxy-Authorizationheader.
false, which uses the standardWWW-AuthenticateandAuthorizationheaders with a401status code.- Parameters:
 proxy-trueto enable proxy authentication mode.
 - 
getAuthorizationHeader
- Returns:
 - The authorization header to read credentials from, either
AuthorizationorProxy-Authorization, depending on the proxy mode. - See Also:
 
 - 
getChallengeHeader
- Returns:
 - The challenge header to send to the client, either
WWW-AuthenticateorProxy-Authenticate, depending on the proxy mode. - See Also:
 
 - 
getUnauthorizedStatusCode
public int getUnauthorizedStatusCode()- Returns:
 - The status code for an authentication challenge, either
401or407, depending on the proxy mode. - See Also:
 
 - 
prepareRequest
public void prepareRequest(javax.servlet.ServletRequest request) Description copied from interface:AuthenticatorCalled prior to validateRequest. The authenticator can manipulate the request to update it with information that can be inspected prior to validateRequest being called. The primary purpose of this method is to satisfy the Servlet Spec 3.1 section 13.6.3 on handling Form authentication where the http method of the original request causing authentication is not the same as the http method resulting from the redirect after authentication.- Specified by:
 prepareRequestin interfaceAuthenticator- Parameters:
 request- the request to manipulate
 - 
login
public UserIdentity login(String username, Object password, javax.servlet.ServletRequest servletRequest) If the UserIdentity returned fromLoginService.login(String, Object, org.eclipse.jetty.server.Request, Function)is not null, it is assumed that the user is fully authenticated and we need to change the session id to prevent session fixation vulnerability. If the UserIdentity is not necessarily fully authenticated, then subclasses must override this method and determine when the UserIdentity IS fully authenticated and renew the session id.- Parameters:
 username- the username of the client to be authenticatedpassword- the user's credentialservletRequest- the inbound request that needs authentication
 - 
logout
public void logout(javax.servlet.ServletRequest request)  - 
setConfiguration
Description copied from interface:AuthenticatorConfigure the Authenticator- Specified by:
 setConfigurationin interfaceAuthenticator- Parameters:
 configuration- the configuration
 - 
getLoginService
 - 
renewSession
protected javax.servlet.http.HttpSession renewSession(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Change the session id. The session is changed to a new instance with a new ID if and only if:- A session exists.
 - The 
Authenticator.AuthConfiguration.isSessionRenewedOnAuthentication()returns true. - The session ID has been given to unauthenticated responses
 
- Parameters:
 request- the requestresponse- the response- Returns:
 - The new session.
 
 
 -