Class KerberosAuthenticator
java.lang.Object
org.apache.hadoop.security.authentication.client.KerberosAuthenticator
- All Implemented Interfaces:
Authenticator
The
KerberosAuthenticator implements the Kerberos SPNEGO authentication sequence.
It uses the default principal for the Kerberos cache (normally set via kinit).
It falls back to the PseudoAuthenticator if the HTTP endpoint does not trigger an SPNEGO authentication
sequence.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringHTTP header used by the SPNEGO client endpoint during an authentication sequence.static final StringHTTP header prefix used by the SPNEGO client/server endpoints during an authentication sequence.static final StringHTTP header used by the SPNEGO server endpoint during an authentication sequence. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticate(URL url, AuthenticatedURL.Token token) Performs SPNEGO authentication against the specified URL.protected AuthenticatorIf the specified URL does not support SPNEGO authentication, a fallbackAuthenticatorwill be used.voidsetConnectionConfigurator(ConnectionConfigurator configurator) Sets aConnectionConfiguratorinstance to use for configuring connections.
-
Field Details
-
WWW_AUTHENTICATE
HTTP header used by the SPNEGO server endpoint during an authentication sequence.- See Also:
-
AUTHORIZATION
HTTP header used by the SPNEGO client endpoint during an authentication sequence.- See Also:
-
NEGOTIATE
HTTP header prefix used by the SPNEGO client/server endpoints during an authentication sequence.- See Also:
-
-
Constructor Details
-
KerberosAuthenticator
public KerberosAuthenticator()
-
-
Method Details
-
setConnectionConfigurator
Sets aConnectionConfiguratorinstance to use for configuring connections.- Specified by:
setConnectionConfiguratorin interfaceAuthenticator- Parameters:
configurator- theConnectionConfiguratorinstance.
-
authenticate
public void authenticate(URL url, AuthenticatedURL.Token token) throws IOException, AuthenticationException Performs SPNEGO authentication against the specified URL.If a token is given it does a NOP and returns the given token.
If no token is given, it will perform the SPNEGO authentication sequence using an HTTP
OPTIONSrequest.- Specified by:
authenticatein interfaceAuthenticator- Parameters:
url- the URl to authenticate against.token- the authentication token being used for the user.- Throws:
IOException- if an IO error occurred.AuthenticationException- if an authentication error occurred.
-
getFallBackAuthenticator
If the specified URL does not support SPNEGO authentication, a fallbackAuthenticatorwill be used.This implementation returns a
PseudoAuthenticator.- Returns:
- the fallback
Authenticator.
-