Class NTCredentials

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

    @Contract(threading=IMMUTABLE)
    public class NTCredentials
    extends java.lang.Object
    implements Credentials, java.io.Serializable
    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:
    Serialized Form
    • Field Summary

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

      Constructors 
      Constructor Description
      NTCredentials​(java.lang.String userName, char[] password, java.lang.String workstation, java.lang.String domain)
      Constructor.
      NTCredentials​(java.lang.String userName, char[] password, java.lang.String workstation, java.lang.String domain, java.lang.String netbiosDomain)
      Constructor.
    • Method Summary

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

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

      • password

        private final char[] password
        Password
      • workstation

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

        private final java.lang.String netbiosDomain
        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)
        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)
        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.
    • Method Detail

      • getUserName

        public java.lang.String getUserName()
      • getDomain

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

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

        public java.lang.String getWorkstation()
        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()
        Overrides:
        hashCode in class java.lang.Object
      • equals

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

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

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

        private static java.lang.String convertHost​(java.lang.String host)
        Convert host to standard form
      • convertDomain

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