Class SpnegoProvider


  • public final class SpnegoProvider
    extends Object
    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.

    Take a look at the SpnegoHttpURLConnection class and the SpnegoHttpFilter class before attempting to implement your own HTTP client.

    For more example usage, see the documentation at http://spnego.sourceforge.net

    Author:
    Darwin V. Felix
    • Method Detail

      • getGSSContext

        public static GSSContext getGSSContext​(GSSCredential creds,
                                               URL url)
                                        throws GSSException
        Returns a GSSContext to be used by custom clients to set data integrity requirements, confidentiality and if mutual authentication is required.
        Parameters:
        creds - credentials of the person to be authenticated
        url - HTTP address of server (used for constructing a GSSName).
        Returns:
        GSSContext
        Throws:
        GSSException
        PrivilegedActionException
      • getAuthScheme

        public static net.sourceforge.spnego.SpnegoAuthScheme getAuthScheme​(String header)
        Returns the SpnegoAuthScheme or 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
      • getUsernamePasswordHandler

        public static CallbackHandler getUsernamePasswordHandler​(String username,
                                                                 String password)
        Used by the BASIC Auth mechanism for establishing a LoginContext to authenticate a client/caller/request.
        Parameters:
        username - client username
        password - client password
        Returns:
        CallbackHandler to be used for establishing a LoginContext