org.apache.hc.client5.http.auth

## Class AuthScope

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

-     @Contract(threading=IMMUTABLE)
      public class AuthScope
      extends Object

  `AuthScope` represents an authentication scope consisting of an application protocol, a host name, a port number, a realm name and an authentication scheme name.
  Since:
    4.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AuthScope(AuthScope authScope)` Creates a copy of the given credentials scope.
    `AuthScope(org.apache.hc.core5.http.HttpHost origin)` Defines auth scope for a specific host of origin.
    `AuthScope(org.apache.hc.core5.http.HttpHost origin, String realm, String schemeName)` Defines auth scope for a specific host of origin.
    `AuthScope(String host, int port)` Defines auth scope with the given `host` and `port`.
    `AuthScope(String protocol, String host, int port, String realm, String schemeName)` Defines auth scope with the given `protocol`, `host`, `port`, `realm`, and `schemeName`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(Object obj)`
    `String` | `getHost()`
    `int` | `getPort()`
    `String` | `getProtocol()`
    `String` | `getRealm()`
    `String` | `getSchemeName()`
    `int` | `hashCode()`
    `int` | `match(AuthScope that)` Tests if the authentication scopes match.
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### AuthScope

          public AuthScope(String protocol,
                   String host,
                   int port,
                   String realm,
                   String schemeName)

      Defines auth scope with the given `protocol`, `host`, `port`, `realm`, and `schemeName`.
      Parameters:
        `protocol` - application protocol. May be `null` if applies to any protocol.
        `host` - authentication host. May be `null` if applies to any host.
        `port` - authentication port. May be `-1` if applies to any port of the host.
        `realm` - authentication realm. May be `null` if applies to any realm on the host.
        `schemeName` - authentication scheme name. May be `null` if applies to any auth scheme supported by the host.

    - #### AuthScope

          public AuthScope(org.apache.hc.core5.http.HttpHost origin,
                   String realm,
                   String schemeName)

      Defines auth scope for a specific host of origin.
      Parameters:
        `origin` - host of origin
        `realm` - authentication realm. May be `null` if applies to any realm on the host.
        `schemeName` - authentication scheme name. May be `null` if applies to any auth scheme supported by the host.
      Since:
        4.2

    - #### AuthScope

          public AuthScope(org.apache.hc.core5.http.HttpHost origin)

      Defines auth scope for a specific host of origin.
      Parameters:
        `origin` - host of origin
      Since:
        4.2

    - #### AuthScope

          public AuthScope(String host,
                   int port)

      Defines auth scope with the given `host` and `port`.
      Parameters:
        `host` - authentication host. May be `null` if applies to any host.
        `port` - authentication port. May be `-1` if applies to any port of the host.

    - #### AuthScope

          public AuthScope(AuthScope authScope)

      Creates a copy of the given credentials scope.

  - ### Method Detail

    - #### getProtocol

          public String getProtocol()

    - #### getHost

          public String getHost()

    - #### getPort

          public int getPort()

    - #### getRealm

          public String getRealm()

    - #### getSchemeName

          public String getSchemeName()

    - #### match

          public int match(AuthScope that)

      Tests if the authentication scopes match.
      Returns:
        the match factor. Negative value signifies no match. Non-negative signifies a match. The greater the returned value the closer the match.

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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