Class NTCredentials

  • All Implemented Interfaces:
    java.io.Serializable, Credentials

    @Deprecated
    @Contract(threading=IMMUTABLE)
    public class NTCredentials
    extends java.lang.Object
    implements Credentials, java.io.Serializable
    Deprecated.
    Do not use. the NTLM authentication scheme is no longer supported. Consider using Basic or Bearer authentication with TLS instead.
    Microsoft Windows specific Credentials representation that includes Windows specific attributes such as name of the domain the user belongs to.
    Since:
    4.0
    See Also:
    UsernamePasswordCredentials, BearerToken, Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String netbiosDomain
      Deprecated.
      The netbios domain the authentication request is against
      private char[] password
      Deprecated.
      Password
      private NTUserPrincipal principal
      Deprecated.
      The user principal
      private static long serialVersionUID
      Deprecated.
       
      private java.lang.String workstation
      Deprecated.
      The netbios hostname the authentication request is originating from.
    • Constructor Summary

      Constructors 
      Constructor Description
      NTCredentials​(char[] password, java.lang.String userName, java.lang.String domain, java.lang.String netbiosDomain)
      Deprecated.
      Constructor to create an instance of NTCredentials.
      NTCredentials​(java.lang.String userName, char[] password, java.lang.String workstation, java.lang.String domain)
      Deprecated.
      Constructor.
      NTCredentials​(java.lang.String userName, char[] password, java.lang.String workstation, java.lang.String domain, java.lang.String netbiosDomain)
      Deprecated.
      Constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private static java.lang.String convertDomain​(java.lang.String domain)
      Deprecated.
      Convert domain to standard form
      boolean equals​(java.lang.Object o)
      Deprecated.
       
      java.lang.String getDomain()
      Deprecated.
      Retrieves the name to authenticate with.
      java.lang.String getNetbiosDomain()
      Deprecated.
      Retrieves the netbios domain to authenticate with.
      char[] getPassword()
      Deprecated.
       
      java.lang.String getUserName()
      Deprecated.
       
      java.security.Principal getUserPrincipal()
      Deprecated.
       
      java.lang.String getWorkstation()
      Deprecated.
      Retrieves the netbios workstation name of the computer originating the request.
      private static java.lang.String getWorkstationName()
      Deprecated.
      Retrieves the workstation name of the computer originating the request.
      int hashCode()
      Deprecated.
       
      private static java.lang.String stripDotSuffix​(java.lang.String value)
      Deprecated.
      Strip dot suffix from a name
      java.lang.String toString()
      Deprecated.
       
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Deprecated.
        See Also:
        Constant Field Values
      • principal

        private final NTUserPrincipal principal
        Deprecated.
        The user principal
      • password

        private final char[] password
        Deprecated.
        Password
      • workstation

        private final java.lang.String workstation
        Deprecated.
        The netbios hostname the authentication request is originating from.
      • netbiosDomain

        private final java.lang.String netbiosDomain
        Deprecated.
        The netbios domain the authentication request is against
    • Constructor Detail

      • NTCredentials

        public NTCredentials​(java.lang.String userName,
                             char[] password,
                             java.lang.String workstation,
                             java.lang.String domain)
        Deprecated.
        Constructor.
        Parameters:
        userName - The user name. This should not include the domain to authenticate with. For example: "user" is correct whereas "DOMAIN\user" is not.
        password - The password.
        workstation - The workstation the authentication request is originating from. Essentially, the computer name for this machine.
        domain - The domain to authenticate within.
      • NTCredentials

        public NTCredentials​(java.lang.String userName,
                             char[] password,
                             java.lang.String workstation,
                             java.lang.String domain,
                             java.lang.String netbiosDomain)
        Deprecated.
        Constructor.
        Parameters:
        userName - The user name. This should not include the domain to authenticate with. For example: "user" is correct whereas "DOMAIN\user" is not.
        password - The password.
        workstation - The netbios workstation name that the authentication request is originating from. Essentially, the computer name for this machine.
        domain - The domain to authenticate within.
        netbiosDomain - The netbios version of the domain name.
      • NTCredentials

        public NTCredentials​(char[] password,
                             java.lang.String userName,
                             java.lang.String domain,
                             java.lang.String netbiosDomain)
        Deprecated.
        Constructor to create an instance of NTCredentials.
        Parameters:
        password - The password to use for authentication. Must not be null.
        userName - The user name for authentication. This should not include the domain to authenticate with. For example: "user" is correct whereas "DOMAIN\user" is not. Must not be null.
        domain - The domain to authenticate within. Can be null.
        netbiosDomain - An alternative representation of the domain name in NetBIOS format. Can be null. This parameter is provided to accommodate specific scenarios that require the NetBIOS version of the domain name.

        This constructor creates a new instance of NTCredentials, determining the workstation name at runtime using the getWorkstationName() method. The workstation name will be converted to uppercase using the Locale.ROOT locale.

    • Method Detail

      • getUserPrincipal

        public java.security.Principal getUserPrincipal()
        Deprecated.
        Specified by:
        getUserPrincipal in interface Credentials
      • getUserName

        public java.lang.String getUserName()
        Deprecated.
      • getDomain

        public java.lang.String getDomain()
        Deprecated.
        Retrieves the name to authenticate with.
        Returns:
        String the domain these credentials are intended to authenticate with.
      • getNetbiosDomain

        public java.lang.String getNetbiosDomain()
        Deprecated.
        Retrieves the netbios domain to authenticate with.
        Returns:
        String the netbios domain name.
      • getWorkstation

        public java.lang.String getWorkstation()
        Deprecated.
        Retrieves the netbios workstation name of the computer originating the request.
        Returns:
        String the netbios workstation the user is logged into.
      • hashCode

        public int hashCode()
        Deprecated.
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Deprecated.
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Deprecated.
        Overrides:
        toString in class java.lang.Object
      • stripDotSuffix

        private static java.lang.String stripDotSuffix​(java.lang.String value)
        Deprecated.
        Strip dot suffix from a name
      • convertDomain

        private static java.lang.String convertDomain​(java.lang.String domain)
        Deprecated.
        Convert domain to standard form
      • getWorkstationName

        private static java.lang.String getWorkstationName()
        Deprecated.
        Retrieves the workstation name of the computer originating the request. This method attempts to get the local host name using the InetAddress class. If it fails to retrieve the host name due to an UnknownHostException, it returns "localhost" as a fallback.
        Returns:
        The unqualified workstation name as a String.