Package org.wildfly.security.http.spnego
Class SpnegoAuthenticationMechanism
- java.lang.Object
-
- org.wildfly.security.http.spnego.SpnegoAuthenticationMechanism
-
- All Implemented Interfaces:
HttpServerAuthenticationMechanism
public final class SpnegoAuthenticationMechanism extends Object implements HttpServerAuthenticationMechanism
AHttpServerAuthenticationMechanismimplementation to support SPNEGO.- Author:
- Darran Lofthouse
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSpnegoAuthenticationMechanism.SpnegoContext
-
Field Summary
Fields Modifier and Type Field Description private static StringCACHED_IDENTITY_KEYprivate CallbackHandlercallbackHandlerprivate static StringCHALLENGE_PREFIXprivate booleandisableRestoreSecurityIdentityprivate booleandisableSessionIdChangeprivate GSSManagergssManagerprivate static byte[]NEG_STATE_REJECTprivate static StringSPNEGO_CONTEXT_KEYprivate Scope[]storageScopes
-
Constructor Summary
Constructors Constructor Description SpnegoAuthenticationMechanism(CallbackHandler callbackHandler, Map<String,?> properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanattemptReAuthentication(IdentityCache identityCache, HttpServerRequest request)private booleanauthorizeSrcName(GSSContext gssContext, IdentityCache identityCache)private static voidclearAttachments(HttpScope scope)private IdentityCachecreateIdentityCache(IdentityCache existingCache, HttpScope httpScope, boolean forUpdate)voidevaluateRequest(HttpServerRequest request)Evaluate the current request and attempt to authenticate if appropriate.StringgetMechanismName()Get the name of this mechanism, where appropriate this should be the IANA registered name.private HttpScopegetStorageScope(HttpServerRequest request)private voidhandleCallback(Callback callback)private voidsendBareChallenge(HttpServerResponse response)private voidsendChallenge(byte[] responseToken, HttpServerResponse response, int statusCode)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.wildfly.security.http.HttpServerAuthenticationMechanism
dispose, getNegotiatedProperty, getNegotiationProperty
-
-
-
-
Field Detail
-
CHALLENGE_PREFIX
private static final String CHALLENGE_PREFIX
- See Also:
- Constant Field Values
-
SPNEGO_CONTEXT_KEY
private static final String SPNEGO_CONTEXT_KEY
-
CACHED_IDENTITY_KEY
private static final String CACHED_IDENTITY_KEY
-
NEG_STATE_REJECT
private static final byte[] NEG_STATE_REJECT
-
callbackHandler
private final CallbackHandler callbackHandler
-
gssManager
private final GSSManager gssManager
-
storageScopes
private final Scope[] storageScopes
-
disableRestoreSecurityIdentity
private final boolean disableRestoreSecurityIdentity
-
disableSessionIdChange
private final boolean disableSessionIdChange
-
-
Constructor Detail
-
SpnegoAuthenticationMechanism
SpnegoAuthenticationMechanism(CallbackHandler callbackHandler, Map<String,?> properties)
-
-
Method Detail
-
getMechanismName
public String getMechanismName()
Description copied from interface:HttpServerAuthenticationMechanismGet the name of this mechanism, where appropriate this should be the IANA registered name.- Specified by:
getMechanismNamein interfaceHttpServerAuthenticationMechanism- Returns:
- the name of the mechanism.
-
evaluateRequest
public void evaluateRequest(HttpServerRequest request) throws HttpAuthenticationException
Description copied from interface:HttpServerAuthenticationMechanismEvaluate the current request and attempt to authenticate if appropriate. The mechanism should call the appropriate callback methods on the {link HttpServerResponse} to both indicate the outcome of the evaluation and to register anyHttpServerMechanismsResponderas required.- Specified by:
evaluateRequestin interfaceHttpServerAuthenticationMechanism- Parameters:
request- representation of the HTTP request.- Throws:
HttpAuthenticationException- if there is an internal failure handling the authentication.
-
getStorageScope
private HttpScope getStorageScope(HttpServerRequest request) throws HttpAuthenticationException
- Throws:
HttpAuthenticationException
-
createIdentityCache
private IdentityCache createIdentityCache(IdentityCache existingCache, HttpScope httpScope, boolean forUpdate)
-
clearAttachments
private static void clearAttachments(HttpScope scope)
-
sendBareChallenge
private void sendBareChallenge(HttpServerResponse response)
-
sendChallenge
private void sendChallenge(byte[] responseToken, HttpServerResponse response, int statusCode)
-
attemptReAuthentication
private boolean attemptReAuthentication(IdentityCache identityCache, HttpServerRequest request) throws HttpAuthenticationException
- Throws:
HttpAuthenticationException
-
authorizeSrcName
private boolean authorizeSrcName(GSSContext gssContext, IdentityCache identityCache) throws HttpAuthenticationException
- Throws:
HttpAuthenticationException
-
handleCallback
private void handleCallback(Callback callback) throws HttpAuthenticationException
- Throws:
HttpAuthenticationException
-
-