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

public Class SPNEGOAuthenticator

extends LoginAuthenticator
Class Inheritance
Imports
java.io.Serializable, java.time.Duration, .Instant, org.eclipse.jetty.http.HttpHeader, .HttpMethod, .HttpStatus, org.eclipse.jetty.security.AuthenticationState, .Authenticator, .RoleDelegateUserIdentity, .SPNEGOLoginService, .SPNEGOUserPrincipal, .ServerAuthException, .UserIdentity, org.eclipse.jetty.server.Request, .Response, .Session, org.eclipse.jetty.util.Callback, org.slf4j.Logger, .LoggerFactory

A LoginAuthenticator that uses SPNEGO and the GSS API to authenticate requests.

A successful authentication from a client is cached for a configurable duration using the HTTP session; this avoids that the client is asked to authenticate for every request.

See Also
SPNEGOLoginService

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private Duration
private final String
private static final Logger
Inherited from org.eclipse.jetty.security.authentication.LoginAuthenticator:
_identityService_loginService

Constructor Summary

AccessConstructor and Description
public
public
SPNEGOAuthenticator(String
the authenticator name
type
)

Allow for a custom name value to be set for instances where SPNEGO may not be appropriate

Method Summary

Modifier and TypeMethod and Description
public Duration

Returns:

the authentication duration
getAuthenticationDuration
()

Get the authentication duration.

public String
private String
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)

Overrides org.eclipse.jetty.security.authentication.LoginAuthenticator.login.

Only renew the session id if the user has been fully authenticated, don't renew the session for any of the intermediate request/response handshakes.

private void
sendChallenge(Request req, Response res, Callback callback, String token)

public void
setAuthenticationDuration(Duration
the authentication duration
authenticationDuration
)

Sets the duration of the authentication.

private void
setSpnegoToken(Response response, String token)

public AuthenticationState
validateRequest(Request
The request
req
,
Response
The response
res
,
Callback
the callback to use for writing a response
callback
)

Implements org.eclipse.jetty.security.Authenticator.validateRequest.

Validate a request

Inherited from org.eclipse.jetty.security.authentication.LoginAuthenticator:
getLoginServicelogoutsetConfigurationupdateSession

Field Detail

_authenticationDurationback to summary
private Duration _authenticationDuration
_typeback to summary
private final String _type
LOGback to summary
private static final Logger LOG

Hides org.eclipse.jetty.security.authentication.LoginAuthenticator.LOG.

Constructor Detail

SPNEGOAuthenticatorback to summary
public SPNEGOAuthenticator()
SPNEGOAuthenticatorback to summary
public SPNEGOAuthenticator(String type)

Allow for a custom name value to be set for instances where SPNEGO may not be appropriate

Parameters
type:String

the authenticator name

Method Detail

getAuthenticationDurationback to summary
public Duration getAuthenticationDuration()

Get the authentication duration.

Returns:Duration

the authentication duration

getAuthenticationTypeback to summary
public String getAuthenticationType()

Implements org.eclipse.jetty.security.Authenticator.getAuthenticationType.

Returns:String

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

The name of the authentication type

Annotations
@Override
getSpnegoTokenback to summary
private String getSpnegoToken(String header)
loginback to summary
public UserIdentity login(String username, Object password, Request request, Response response)

Overrides org.eclipse.jetty.security.authentication.LoginAuthenticator.login.

Only renew the session id if the user has been fully authenticated, don't renew the session for any of the intermediate request/response handshakes.

Parameters
username:String

Doc from org.eclipse.jetty.security.authentication.LoginAuthenticator.login.

the username of the client to be authenticated

password:Object

Doc from org.eclipse.jetty.security.authentication.LoginAuthenticator.login.

the user's credential

request:Request

Doc from org.eclipse.jetty.security.authentication.LoginAuthenticator.login.

the inbound request that needs authentication

Annotations
@Override
sendChallengeback to summary
private void sendChallenge(Request req, Response res, Callback callback, String token)
setAuthenticationDurationback to summary
public void setAuthenticationDuration(Duration authenticationDuration)

Sets the duration of the authentication.

A negative duration means that the authentication is only valid for the current request.

A zero duration means that the authentication is valid forever.

A positive value means that the authentication is valid for the specified duration.

Parameters
authenticationDuration:Duration

the authentication duration

setSpnegoTokenback to summary
private void setSpnegoToken(Response response, String token)
validateRequestback to summary
public AuthenticationState validateRequest(Request req, Response res, Callback callback) throws ServerAuthException

Implements org.eclipse.jetty.security.Authenticator.validateRequest.

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

Validate a request

Parameters
req:Request

The request

res:Response

The response

callback:Callback

the callback to use for writing a response

Returns:AuthenticationState

An Authentication. If Authentication is successful, this will be a Succeeded. If a response has been sent by the Authenticator (which can be done for both successful and unsuccessful authentications), then the result will implement AuthenticationState.ResponseSent.

Annotations
@Override
Exceptions
ServerAuthException:
if unable to validate request
org.eclipse.jetty.security.authentication back to summary

private Class SPNEGOAuthenticator.UserIdentityHolder

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • org.eclipse.jetty.security.authentication.SPNEGOAuthenticator.UserIdentityHolder
All Implemented Interfaces
java.io.Serializable

Field Summary

Modifier and TypeField and Description
private final transient UserIdentity
private final transient Instant
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_userIdentityback to summary
private final transient UserIdentity _userIdentity
_validFromback to summary
private final transient Instant _validFrom
ATTRIBUTEback to summary
private static final String ATTRIBUTE

Constructor Detail

UserIdentityHolderback to summary
private UserIdentityHolder(UserIdentity userIdentity)