Class GssApiMechanisms


  • public class GssApiMechanisms
    extends java.lang.Object
    Global repository of GSS-API mechanisms that we can use.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String GSSAPI_HOST_PREFIX
      Prefix to use with GSSName.NT_HOSTBASED_SERVICE.
      static org.ietf.jgss.Oid KERBEROS_5
      The Oid of Kerberos 5.
      private static java.lang.Object LOCK
      static org.ietf.jgss.Oid SPNEGO
      SGNEGO is not to be used with ssh.
      private static java.util.Map<org.ietf.jgss.Oid,​java.lang.Boolean> supportedMechanisms
      The AtomicBoolean is set to true when the mechanism could be initialized successfully at least once.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private GssApiMechanisms()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void closeContextSilently​(org.ietf.jgss.GSSContext context)
      Closes (disposes of) a GSSContext ignoring any GSSExceptions.
      static org.ietf.jgss.GSSContext createContext​(org.ietf.jgss.Oid mechanism, java.lang.String fqdn)
      Creates a GSSContext for the given mechanism to authenticate with the host given by fqdn.
      private static org.ietf.jgss.Oid createOid​(java.lang.String rep)  
      static void failed​(org.ietf.jgss.Oid mechanism)
      Mark the mechanisms as failed.
      static java.lang.String getCanonicalName​(java.net.InetSocketAddress remote)
      Determines a canonical host name for use use with GSS-API.
      static java.util.Collection<org.ietf.jgss.Oid> getSupportedMechanisms()
      Retrieves an immutable collection of the supported mechanisms.
      static java.net.InetAddress resolve​(java.net.InetSocketAddress remote)
      Resolves an InetSocketAddress.
      static void worked​(org.ietf.jgss.Oid mechanism)
      Report that this mechanism was used successfully.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • GSSAPI_HOST_PREFIX

        public static final java.lang.String GSSAPI_HOST_PREFIX
        Prefix to use with GSSName.NT_HOSTBASED_SERVICE.
        See Also:
        Constant Field Values
      • KERBEROS_5

        public static final org.ietf.jgss.Oid KERBEROS_5
        The Oid of Kerberos 5.
      • SPNEGO

        public static final org.ietf.jgss.Oid SPNEGO
        SGNEGO is not to be used with ssh.
      • supportedMechanisms

        private static java.util.Map<org.ietf.jgss.Oid,​java.lang.Boolean> supportedMechanisms
        The AtomicBoolean is set to true when the mechanism could be initialized successfully at least once.
    • Constructor Detail

      • GssApiMechanisms

        private GssApiMechanisms()
    • Method Detail

      • getSupportedMechanisms

        @NonNull
        public static java.util.Collection<org.ietf.jgss.Oid> getSupportedMechanisms()
        Retrieves an immutable collection of the supported mechanisms.
        Returns:
        the supported mechanisms
      • worked

        public static void worked​(@NonNull
                                  org.ietf.jgss.Oid mechanism)
        Report that this mechanism was used successfully.
        Parameters:
        mechanism - that worked
      • failed

        public static void failed​(@NonNull
                                  org.ietf.jgss.Oid mechanism)
        Mark the mechanisms as failed.
        Parameters:
        mechanism - to mark
      • resolve

        public static java.net.InetAddress resolve​(@NonNull
                                                   java.net.InetSocketAddress remote)
        Resolves an InetSocketAddress.
        Parameters:
        remote - to resolve
        Returns:
        the resolved InetAddress, or null if unresolved.
      • getCanonicalName

        @NonNull
        public static java.lang.String getCanonicalName​(@NonNull
                                                        java.net.InetSocketAddress remote)
        Determines a canonical host name for use use with GSS-API.
        Parameters:
        remote - to get the host name from
        Returns:
        the canonical host name, if it can be determined, otherwise the unprocessed host name.
      • createContext

        public static org.ietf.jgss.GSSContext createContext​(@NonNull
                                                             org.ietf.jgss.Oid mechanism,
                                                             @NonNull
                                                             java.lang.String fqdn)
        Creates a GSSContext for the given mechanism to authenticate with the host given by fqdn.
        Parameters:
        mechanism - Oid of the mechanism to use
        fqdn - fully qualified domain name of the host to authenticate with
        Returns:
        the context, if the mechanism is available and the context could be created, or null otherwise
      • closeContextSilently

        public static void closeContextSilently​(org.ietf.jgss.GSSContext context)
        Closes (disposes of) a GSSContext ignoring any GSSExceptions.
        Parameters:
        context - to dispose
      • createOid

        private static org.ietf.jgss.Oid createOid​(java.lang.String rep)