Class GGSSchemeBase
java.lang.Object
org.apache.hc.client5.http.impl.auth.GGSSchemeBase
- All Implemented Interfaces:
AuthScheme
- Direct Known Subclasses:
KerberosScheme,SPNegoScheme
Common behavior for
GSS based authentication schemes.- Since:
- 4.2
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate final KerberosConfigprivate final DnsResolverprivate GSSCredentialprivate static final Stringprivate static final org.slf4j.Loggerprivate static final Stringprivate GGSSchemeBase.StateAuthentication process stateprivate byte[] -
Constructor Summary
ConstructorsConstructorDescriptionGGSSchemeBase(KerberosConfig config) GGSSchemeBase(KerberosConfig config, DnsResolver dnsResolver) -
Method Summary
Modifier and TypeMethodDescriptionprotected GSSContextcreateGSSContext(GSSManager manager, Oid oid, GSSName serverName, GSSCredential gssCredential) generateAuthResponse(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) Generates an authorization response based on the current state.protected byte[]generateGSSToken(byte[] input, Oid oid, String serviceName, String authServer) protected abstract byte[]generateToken(byte[] input, String serviceName, String authServer) protected GSSManagerReturnsPrincipalwhose credentials are used to generate an authentication response.getRealm()Returns authentication realm.booleanAuthentication process may involve a series of challenge-response exchanges.booleanisResponseReady(org.apache.hc.core5.http.HttpHost host, CredentialsProvider credentialsProvider, org.apache.hc.core5.http.protocol.HttpContext context) Determines whether or not an authorization response can be generated based on the actual authentication state.voidprocessChallenge(AuthChallenge authChallenge, org.apache.hc.core5.http.protocol.HttpContext context) Processes the given auth challenge.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hc.client5.http.auth.AuthScheme
getName, isConnectionBased
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
NO_TOKEN
- See Also:
-
KERBEROS_SCHEME
- See Also:
-
config
-
dnsResolver
-
state
Authentication process state -
gssCredential
-
challenge
-
token
private byte[] token
-
-
Constructor Details
-
GGSSchemeBase
GGSSchemeBase(KerberosConfig config, DnsResolver dnsResolver) -
GGSSchemeBase
GGSSchemeBase(KerberosConfig config) -
GGSSchemeBase
GGSSchemeBase()
-
-
Method Details
-
getRealm
Description copied from interface:AuthSchemeReturns authentication realm. If the concept of an authentication realm is not applicable to the given authentication scheme, returnsnull.- Specified by:
getRealmin interfaceAuthScheme- Returns:
- the authentication realm
-
processChallenge
public void processChallenge(AuthChallenge authChallenge, org.apache.hc.core5.http.protocol.HttpContext context) throws MalformedChallengeException Description copied from interface:AuthSchemeProcesses the given auth challenge. Some authentication schemes may involve multiple challenge-response exchanges. Such schemes must be able to maintain internal state when dealing with sequential challenges- Specified by:
processChallengein interfaceAuthScheme- Parameters:
authChallenge- the auth challengecontext- HTTP context- Throws:
MalformedChallengeException- in case the auth challenge is incomplete, malformed or otherwise invalid.
-
getManager
-
generateGSSToken
protected byte[] generateGSSToken(byte[] input, Oid oid, String serviceName, String authServer) throws GSSException - Throws:
GSSException- Since:
- 4.4
-
createGSSContext
protected GSSContext createGSSContext(GSSManager manager, Oid oid, GSSName serverName, GSSCredential gssCredential) throws GSSException - Throws:
GSSException- Since:
- 5.0
-
generateToken
protected abstract byte[] generateToken(byte[] input, String serviceName, String authServer) throws GSSException - Throws:
GSSException- Since:
- 4.4
-
isChallengeComplete
public boolean isChallengeComplete()Description copied from interface:AuthSchemeAuthentication process may involve a series of challenge-response exchanges. This method tests if the authorization process has been fully completed (either successfully or unsuccessfully), that is, all the required authorization challenges have been processed in their entirety.- Specified by:
isChallengeCompletein interfaceAuthScheme- Returns:
trueif the authentication process has been completed,falseotherwise.
-
isResponseReady
public boolean isResponseReady(org.apache.hc.core5.http.HttpHost host, CredentialsProvider credentialsProvider, org.apache.hc.core5.http.protocol.HttpContext context) throws AuthenticationException Description copied from interface:AuthSchemeDetermines whether or not an authorization response can be generated based on the actual authentication state. Generally the outcome of this method will depend upon availability of user credentials necessary to produce an authorization response.- Specified by:
isResponseReadyin interfaceAuthSchemecredentialsProvider- The credentials to be used for authenticationcontext- HTTP context- Returns:
trueif an authorization response can be generated and the authentication handshake can proceed,falseotherwise.- Throws:
AuthenticationException- if authorization string cannot be generated due to an authentication failure
-
getPrincipal
Description copied from interface:AuthSchemeReturnsPrincipalwhose credentials are used to generate an authentication response. Connection based schemes are required to return a userPrincipalif authorization applies to for the entire life span of connection.- Specified by:
getPrincipalin interfaceAuthScheme- Returns:
- user principal
- See Also:
-
generateAuthResponse
public String generateAuthResponse(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.protocol.HttpContext context) throws AuthenticationException Description copied from interface:AuthSchemeGenerates an authorization response based on the current state. Some authentication schemes may need to load user credentials required to generate an authorization response from aCredentialsProviderprior to this method call.- Specified by:
generateAuthResponsein interfaceAuthSchemerequest- The request being authenticatedcontext- HTTP context- Returns:
- authorization header
- Throws:
AuthenticationException- if authorization string cannot be generated due to an authentication failure- See Also:
-
toString
-