Class SPNEGOAuthentication
java.lang.Object
org.eclipse.jetty.client.AbstractAuthentication
org.eclipse.jetty.client.SPNEGOAuthentication
- All Implemented Interfaces:
Authentication
Implementation of the SPNEGO (or "Negotiate") authentication defined in RFC 4559.
A user is logged in via JAAS (either via userName/password or
via userName/keyTab) once only.
For every request that needs authentication, a GSSContext is initiated and
later established after reading the response from the server.
Applications should create objects of this class and add them to the
AuthenticationStore retrieved from the HttpClient
via HttpClient.getAuthenticationStore().
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface Authentication
Authentication.HeaderInfo, Authentication.Result -
Field Summary
Fields inherited from interface Authentication
ANY_REALM -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthenticate(Request request, ContentResponse response, Authentication.HeaderInfo headerInfo, Attributes context) Executes the authentication mechanism for the given request, returning aAuthentication.Resultthat can be used to actually authenticate the request viaAuthentication.Result.apply(Request).Get the name of the service to use.Get the path of the ticket cache file.getType()Get the path of the keyTab file with the user credentials.Get the user name of the user to login.Get the password of the user to login.booleanbooleanvoidsetRenewTGT(boolean renewTGT) Set whether to renew the ticket granting ticket.voidsetServiceName(String serviceName) Set the name of the service to use.voidsetTicketCachePath(Path ticketCachePath) voidsetUserKeyTabPath(Path userKeyTabPath) voidsetUserName(String userName) Set user name of the user to login.voidsetUserPassword(String userPassword) voidsetUseTicketCache(boolean useTicketCache) Methods inherited from class AbstractAuthentication
getRealm, getURI, matches, matchesURI
-
Constructor Details
-
SPNEGOAuthentication
-
-
Method Details
-
getType
- Specified by:
getTypein classAbstractAuthentication
-
getUserName
Get the user name of the user to login.- Returns:
- the user name of the user to login
-
setUserName
Set user name of the user to login.- Parameters:
userName- user name of the user to login
-
getUserPassword
Get the password of the user to login.- Returns:
- the password of the user to login
-
setUserPassword
- Parameters:
userPassword- the password of the user to login- See Also:
-
getUserKeyTabPath
Get the path of the keyTab file with the user credentials.- Returns:
- the path of the keyTab file with the user credentials
-
setUserKeyTabPath
- Parameters:
userKeyTabPath- the path of the keyTab file with the user credentials- See Also:
-
getServiceName
Get the name of the service to use.- Returns:
- the name of the service to use
-
setServiceName
Set the name of the service to use.- Parameters:
serviceName- the name of the service to use
-
isUseTicketCache
public boolean isUseTicketCache()- Returns:
- whether to use the ticket cache during login
-
setUseTicketCache
public void setUseTicketCache(boolean useTicketCache) - Parameters:
useTicketCache- whether to use the ticket cache during login- See Also:
-
getTicketCachePath
Get the path of the ticket cache file.- Returns:
- the path of the ticket cache file
-
setTicketCachePath
- Parameters:
ticketCachePath- the path of the ticket cache file- See Also:
-
isRenewTGT
public boolean isRenewTGT()- Returns:
- whether to renew the ticket granting ticket
-
setRenewTGT
public void setRenewTGT(boolean renewTGT) Set whether to renew the ticket granting ticket.- Parameters:
renewTGT- whether to renew the ticket granting ticket
-
authenticate
public Authentication.Result authenticate(Request request, ContentResponse response, Authentication.HeaderInfo headerInfo, Attributes context) Description copied from interface:AuthenticationExecutes the authentication mechanism for the given request, returning aAuthentication.Resultthat can be used to actually authenticate the request viaAuthentication.Result.apply(Request).If a request for
"/secure"returns aAuthentication.Result, then the result may be used for other requests such as"/secure/foo"or"/secure/bar", unless those resources are protected by other realms.- Parameters:
request- the request to execute the authentication mechanism forresponse- the 401 response obtained in the previous attempt to request the protected resourceheaderInfo- theWWW-Authenticate(orProxy-Authenticate) header chosen for this authentication (among the many that the response may contain)context- the conversation context in case the authentication needs multiple exchanges to be completed and information needs to be stored across exchanges- Returns:
- the authentication result, or null if the authentication could not be performed
-