Package com.kerb4j.common.util
Class SpnegoProvider
java.lang.Object
com.kerb4j.common.util.SpnegoProvider
This is a Utility Class that can be used for finer grained control
over message integrity, confidentiality and mutual authentication.
This Class is exposed for developers who want to implement a custom HTTP client.
For more example usage, see the documentation at http://spnego.sourceforge.net
- Author:
- Darwin V. Felix
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final GSSManagerFactory for GSS-API mechanism.static final Stringstatic final OidGSS-API mechanism "1.2.840.113554.1.2.2".static final Stringstatic final Stringstatic final OidGSS-API mechanism "1.3.6.1.5.5.2".static final Oid[]Note: The MIT Kerberos V5 mechanism OID is added for compatibility with Chromium-based browsers on POSIX OSes. -
Method Summary
Modifier and TypeMethodDescriptionstatic GSSNameReturns theGSSNameconstructed out of the passed-in SPNstatic SpnegoAuthSchemegetAuthScheme(String header) Returns theSpnegoAuthSchemeor null if header is missing.static GSSNamegetServerName(URL url) Returns theGSSNameconstructed out of the passed-in URL object.static CallbackHandlergetUsernameAndPasswordHandler(String username, String password) Used by the BASIC Auth mechanism for establishing a LoginContext to authenticate a client/caller/request.
-
Field Details
-
GSS_MANAGER
Factory for GSS-API mechanism. -
SPNEGO_MECHANISM
- See Also:
-
KERBEROS_MECHANISM
- See Also:
-
LEGACY_KERBEROS_MECHANISM
- See Also:
-
SPNEGO_OID
GSS-API mechanism "1.3.6.1.5.5.2". -
KERBEROS_V5_OID
GSS-API mechanism "1.2.840.113554.1.2.2". -
SUPPORTED_OIDS
Note: The MIT Kerberos V5 mechanism OID is added for compatibility with Chromium-based browsers on POSIX OSes. On these OSes, Chromium erroneously responds to an SPNEGO request with a GSS-API MIT Kerberos V5 mechanism answer (instead of a MIT Kerberos V5 token inside an SPNEGO mechanism answer).
-
-
Method Details
-
getAuthScheme
Returns theSpnegoAuthSchemeor null if header is missing.Throws UnsupportedOperationException if header is NOT Negotiate or Basic.
- Parameters:
header- ex. Negotiate or Basic- Returns:
- null if header missing/null else the auth scheme
-
createGSSNameForSPN
Returns theGSSNameconstructed out of the passed-in SPN- Parameters:
spn-- Returns:
- GSSName of URL.
- Throws:
GSSException
-
getServerName
Returns theGSSNameconstructed out of the passed-in URL object.- Parameters:
url- HTTP address of server- Returns:
- GSSName of URL.
- Throws:
GSSException
-
getUsernameAndPasswordHandler
Used by the BASIC Auth mechanism for establishing a LoginContext to authenticate a client/caller/request.- Parameters:
username- client usernamepassword- client password- Returns:
- CallbackHandler to be used for establishing a LoginContext
-