Top Inners Fields Constructors Methods
org.eclipse.jetty.security.authentication

public abstract Class LoginAuthenticator

extends Object
implements Authenticator
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.security.Authenticator
Known Direct Subclasses
org.eclipse.jetty.security.authentication.SPNEGOAuthenticator, org.eclipse.jetty.security.authentication.SslClientCertAuthenticator, org.eclipse.jetty.security.authentication.BasicAuthenticator, org.eclipse.jetty.security.authentication.DigestAuthenticator, org.eclipse.jetty.security.authentication.FormAuthenticator
Imports
java.io.Serial, .Serializable, java.util.function.Function, org.eclipse.jetty.security.AuthenticationState, .Authenticator, .IdentityService, .LoginService, .SecurityHandler, .UserIdentity, org.eclipse.jetty.server.Request, .Response, .Session, org.eclipse.jetty.util.Callback, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
LoginAuthenticator.UserAuthenticationSent

This Authentication represents a just completed authentication, that has sent a response, typically to redirect the client to the original request target..

public static class
LoginAuthenticator.UserAuthenticationSucceeded

Base class for representing a successful authentication state.

Field Summary

Modifier and TypeField and Description
protected IdentityService
protected LoginService
private int
private boolean
private static final Logger

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public LoginService
public UserIdentity
login(String
the username of the client to be authenticated
username
,
Object
the user's credential
password
,
Request
the inbound request that needs authentication
request
,
Response response)

If the UserIdentity returned from LoginService#login(String, Object, 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.

public void
logout(Request request, Response response)

public void
setConfiguration(Authenticator.Configuration
the configuration
configuration
)

Implements org.eclipse.jetty.security.Authenticator.setConfiguration.

Configure the Authenticator

protected void
updateSession(Request
the request
httpRequest
,
Response
the response
httpResponse
)

Update the session on authentication.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_identityServiceback to summary
protected IdentityService _identityService
_loginServiceback to summary
protected LoginService _loginService
_sessionMaxInactiveIntervalOnAuthenticationback to summary
private int _sessionMaxInactiveIntervalOnAuthentication
_sessionRenewedOnAuthenticationback to summary
private boolean _sessionRenewedOnAuthentication
LOGback to summary
private static final Logger LOG

Constructor Detail

LoginAuthenticatorback to summary
protected LoginAuthenticator()

Method Detail

getLoginServiceback to summary
public LoginService getLoginService()
loginback to summary
public UserIdentity login(String username, Object password, Request request, Response response)

If the UserIdentity returned from LoginService#login(String, Object, 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:String

the username of the client to be authenticated

password:Object

the user's credential

request:Request

the inbound request that needs authentication

logoutback to summary
public void logout(Request request, Response response)
setConfigurationback to summary
public void setConfiguration(Authenticator.Configuration configuration)

Implements org.eclipse.jetty.security.Authenticator.setConfiguration.

Doc from org.eclipse.jetty.security.Authenticator.setConfiguration.

Configure the Authenticator

Parameters
configuration:Authenticator.Configuration

the configuration

Annotations
@Override
updateSessionback to summary
protected void updateSession(Request httpRequest, Response httpResponse)

Update the session on authentication. The session is changed to a new instance with a new ID if and only if:

Parameters
httpRequest:Request

the request

httpResponse:Response

the response

See Also
Configuration#isSessionRenewedOnAuthentication(), Configuration#getSessionMaxInactiveIntervalOnAuthentication()
org.eclipse.jetty.security.authentication back to summary

public Class LoginAuthenticator.LoggedOutAuthentication

extends Object
implements Deferred
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.security.authentication.LoginAuthenticator.LoggedOutAuthentication
All Implemented Interfaces
org.eclipse.jetty.security.AuthenticationState.Deferred, org.eclipse.jetty.security.AuthenticationState, org.eclipse.jetty.server.Request.AuthenticationState

Field Summary

Modifier and TypeField and Description
private final AuthenticationState.Deferred

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public AuthenticationState.Succeeded
authenticate(Request
The request to authenticate
request
)

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.authenticate.

Authenticate the request using any credentials already associated with the request.

public AuthenticationState
authenticate(Request
The request to authenticate
request
,
Response
The response to use for a challenge.
response
,
Callback
The callback to complete if a challenge is sent
callback
)

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.authenticate.

Authenticate the request using any credentials already associated with the request or challenging if necessary.

public IdentityService.Association
public AuthenticationState.Succeeded
login(String
The username to validate
username
,
Object
The credential to validate
password
,
Request
The request to authenticate
request
,
Response
The response, which may be updated if the session ID is changed.
response
)

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.login.

Authenticate the request with the passed credentials

public void
logout(Request
The authenticated request
request
,
Response
The associated response, which may be updated to clear a session ID.
response
)

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.logout.

Logout the authenticated user.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_delegateback to summary
private final AuthenticationState.Deferred _delegate

Constructor Detail

LoggedOutAuthenticationback to summary
public LoggedOutAuthentication(LoginAuthenticator authenticator)

Method Detail

authenticateback to summary
public AuthenticationState.Succeeded authenticate(Request request)

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.authenticate.

Doc from org.eclipse.jetty.security.AuthenticationState.Deferred.authenticate.

Authenticate the request using any credentials already associated with the request. No challenge can be sent. If the login is successful, then the IdentityService#associate(UserIdentity, RunAsToken) method is used and the returned org.eclipse.jetty.security.IdentityService.Association is made available via getAssociation().

Parameters
request:Request

The request to authenticate

Returns:AuthenticationState.Succeeded

A Succeeded authentication or null

Annotations
@Override
authenticateback to summary
public AuthenticationState authenticate(Request request, Response response, Callback callback)

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.authenticate.

Doc from org.eclipse.jetty.security.AuthenticationState.Deferred.authenticate.

Authenticate the request using any credentials already associated with the request or challenging if necessary. If the login is successful, then the IdentityService#associate(UserIdentity, RunAsToken) method is used and the returned org.eclipse.jetty.security.IdentityService.Association is made available via getAssociation().

Parameters
request:Request

The request to authenticate

response:Response

The response to use for a challenge.

callback:Callback

The callback to complete if a challenge is sent

Returns:AuthenticationState

The next AuthenticationState, if it is ResponseSent, then the callback will be completed.

Annotations
@Override
getAssociationback to summary
public IdentityService.Association getAssociation()

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.getAssociation.

Returns:IdentityService.Association

Doc from org.eclipse.jetty.security.AuthenticationState.Deferred.getAssociation.

Any org.eclipse.jetty.security.IdentityService.Association created during deferred authentication.

Annotations
@Override
loginback to summary
public AuthenticationState.Succeeded login(String username, Object password, Request request, Response response)

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.login.

Doc from org.eclipse.jetty.security.AuthenticationState.Deferred.login.

Authenticate the request with the passed credentials

Parameters
username:String

The username to validate

password:Object

The credential to validate

request:Request

The request to authenticate

response:Response

The response, which may be updated if the session ID is changed.

Returns:AuthenticationState.Succeeded

A Succeeded authentication or null

Annotations
@Override
logoutback to summary
public void logout(Request request, Response response)

Implements org.eclipse.jetty.security.AuthenticationState.Deferred.logout.

Doc from org.eclipse.jetty.security.AuthenticationState.Deferred.logout.

Logout the authenticated user.

Parameters
request:Request

The authenticated request

response:Response

The associated response, which may be updated to clear a session ID.

Annotations
@Override
org.eclipse.jetty.security.authentication back to summary

public Class LoginAuthenticator.UserAuthenticationSent

extends UserAuthenticationSucceeded
implements ResponseSent
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.security.AuthenticationState.ResponseSent, org.eclipse.jetty.security.AuthenticationState, org.eclipse.jetty.server.Request.AuthenticationState

This Authentication represents a just completed authentication, that has sent a response, typically to redirect the client to the original request target..

Field Summary

Inherited from org.eclipse.jetty.security.authentication.LoginAuthenticator.UserAuthenticationSucceeded:
_authenticationType_userIdentity

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.eclipse.jetty.security.authentication.LoginAuthenticator.UserAuthenticationSucceeded:
getAuthenticationTypegetUserIdentityisUserInRolelogouttoString

Constructor Detail

UserAuthenticationSentback to summary
public UserAuthenticationSent(String method, UserIdentity userIdentity)
org.eclipse.jetty.security.authentication back to summary

public Class LoginAuthenticator.UserAuthenticationSucceeded

extends Object
implements Succeeded, Serializable
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.security.authentication.LoginAuthenticator.UserAuthenticationSucceeded
All Implemented Interfaces
java.io.Serializable, org.eclipse.jetty.security.AuthenticationState.Succeeded, org.eclipse.jetty.security.AuthenticationState, org.eclipse.jetty.server.Request.AuthenticationState
Known Direct Subclasses
org.eclipse.jetty.security.authentication.LoginAuthenticator.UserAuthenticationSent, org.eclipse.jetty.security.authentication.SessionAuthentication

Base class for representing a successful authentication state.

Field Summary

Modifier and TypeField and Description
protected String
protected transient UserIdentity
private static final long

Constructor Summary

AccessConstructor and Description
public
UserAuthenticationSucceeded(String authenticationType, UserIdentity userIdentity)

Method Summary

Modifier and TypeMethod and Description
public String
public UserIdentity
public boolean
public void
logout(Request
the request
request
,
Response
the response
response
)

Implements org.eclipse.jetty.security.AuthenticationState.Succeeded.logout.

Remove any user information that may be present in the request such that a call to getUserPrincipal/getRemoteUser will return null.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_authenticationTypeback to summary
protected String _authenticationType
_userIdentityback to summary
protected transient UserIdentity _userIdentity
serialVersionUIDback to summary
private static final long serialVersionUID
Annotations
@Serial

Constructor Detail

UserAuthenticationSucceededback to summary
public UserAuthenticationSucceeded(String authenticationType, UserIdentity userIdentity)

Method Detail

getAuthenticationTypeback to summary
public String getAuthenticationType()

Implements org.eclipse.jetty.security.AuthenticationState.Succeeded.getAuthenticationType.

Returns:String

Doc from org.eclipse.jetty.security.AuthenticationState.Succeeded.getAuthenticationType.

The method used to authenticate the user.

Annotations
@Override
getUserIdentityback to summary
public UserIdentity getUserIdentity()

Implements org.eclipse.jetty.security.AuthenticationState.Succeeded.getUserIdentity.

Returns:UserIdentity

Doc from org.eclipse.jetty.security.AuthenticationState.Succeeded.getUserIdentity.

The UserIdentity of the authenticated user.

Annotations
@Override
isUserInRoleback to summary
public boolean isUserInRole(String role)

Implements org.eclipse.jetty.security.AuthenticationState.Succeeded.isUserInRole.

Parameters
role:String

Doc from org.eclipse.jetty.security.AuthenticationState.Succeeded.isUserInRole.

The role to check.

Returns:boolean

Doc from org.eclipse.jetty.security.AuthenticationState.Succeeded.isUserInRole.

True if the user is in the passed role

Annotations
@Override
logoutback to summary
public void logout(Request request, Response response)

Implements org.eclipse.jetty.security.AuthenticationState.Succeeded.logout.

Doc from org.eclipse.jetty.security.AuthenticationState.Succeeded.logout.

Remove any user information that may be present in the request such that a call to getUserPrincipal/getRemoteUser will return null.

Parameters
request:Request

the request

response:Response

the response

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override