org.apache.hc.client5.http.auth

## Class NTCredentials

- java.lang.Object
- - org.apache.hc.client5.http.auth.NTCredentials

- All Implemented Interfaces:
    Serializable, Credentials

      @Contract(threading=IMMUTABLE)
      public class NTCredentials
      extends Object
      implements Credentials, 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

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NTCredentials(String userName, char[] password, String workstation, String domain)` Constructor.
    `NTCredentials(String userName, char[] password, String workstation, String domain, String netbiosDomain)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object o)`
    `String` | `getDomain()` Retrieves the name to authenticate with.
    `String` | `getNetbiosDomain()` Retrieves the netbios domain to authenticate with.
    `char[]` | `getPassword()`
    `String` | `getUserName()`
    `Principal` | `getUserPrincipal()`
    `String` | `getWorkstation()` Retrieves the netbios workstation name of the computer originating the request.
    `int` | `hashCode()`
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### NTCredentials

          public NTCredentials(String userName,
                       char[] password,
                       String workstation,
                       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(String userName,
                       char[] password,
                       String workstation,
                       String domain,
                       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

    - #### getUserPrincipal

          public Principal getUserPrincipal()

      Specified by:
        `getUserPrincipal` in interface `Credentials`

    - #### getUserName

          public String getUserName()

    - #### getPassword

          public char[] getPassword()

      Specified by:
        `getPassword` in interface `Credentials`

    - #### getDomain

          public String getDomain()

      Retrieves the name to authenticate with.
      Returns:
        String the domain these credentials are intended to authenticate with.

    - #### getNetbiosDomain

          public String getNetbiosDomain()

      Retrieves the netbios domain to authenticate with.
      Returns:
        String the netbios domain name.

    - #### getWorkstation

          public 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 `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 1999–2022 The Apache Software Foundation. All rights reserved.