public class

AuthScope

extends Object
java.lang.Object
   ↳ org.apache.http.auth.AuthScope

Class Overview

The class represents an authentication scope consisting of a host name, a port number, a realm name and an authentication scheme name which Credentials apply to.

Summary

Constants
AuthScope ANY Default scope matching any host, port, realm and authentication scheme.
String ANY_HOST The null value represents any host.
int ANY_PORT The -1 value represents any port.
String ANY_REALM The null value represents any realm.
String ANY_SCHEME The null value represents any authentication scheme.
Public Constructors
AuthScope(String host, int port, String realm, String scheme)
Creates a new credentials scope for the given host, port, realm, and authentication scheme.
AuthScope(String host, int port, String realm)
Creates a new credentials scope for the given host, port, realm, and any authentication scheme.
AuthScope(String host, int port)
Creates a new credentials scope for the given host, port, any realm name, and any authentication scheme.
AuthScope(AuthScope authscope)
Creates a copy of the given credentials scope.
Public Methods
boolean equals(Object o)
Compares this instance with the specified object and indicates if they are equal.
String getHost()
int getPort()
String getRealm()
String getScheme()
int hashCode()
Returns an integer hash code for this object.
int match(AuthScope that)
Tests if the authentication scopes match.
String toString()
Returns a string containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final AuthScope ANY

Default scope matching any host, port, realm and authentication scheme. In the future versions of HttpClient the use of this parameter will be discontinued.

public static final String ANY_HOST

The null value represents any host. In the future versions of HttpClient the use of this parameter will be discontinued.

public static final int ANY_PORT

The -1 value represents any port.

Constant Value: -1 (0xffffffff)

public static final String ANY_REALM

The null value represents any realm.

public static final String ANY_SCHEME

The null value represents any authentication scheme.

Public Constructors

public AuthScope (String host, int port, String realm, String scheme)

Creates a new credentials scope for the given host, port, realm, and authentication scheme.

Parameters
host the host the credentials apply to. May be set to null if credenticals are applicable to any host.
port the port the credentials apply to. May be set to negative value if credenticals are applicable to any port.
realm the realm the credentials apply to. May be set to null if credenticals are applicable to any realm.
scheme the authentication scheme the credentials apply to. May be set to null if credenticals are applicable to any authentication scheme.

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

Creates a new credentials scope for the given host, port, realm, and any authentication scheme.

Parameters
host the host the credentials apply to. May be set to null if credenticals are applicable to any host.
port the port the credentials apply to. May be set to negative value if credenticals are applicable to any port.
realm the realm the credentials apply to. May be set to null if credenticals are applicable to any realm.

public AuthScope (String host, int port)

Creates a new credentials scope for the given host, port, any realm name, and any authentication scheme.

Parameters
host the host the credentials apply to. May be set to null if credenticals are applicable to any host.
port the port the credentials apply to. May be set to negative value if credenticals are applicable to any port.

public AuthScope (AuthScope authscope)

Creates a copy of the given credentials scope.

Public Methods

public boolean equals (Object o)

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be both transitive and reflexive.

The implementation in Object returns true only if o is the exact same object as the receiver (using the == operator for comparison). Subclasses often implement equals(Object) so that it takes into account the two object's types and states.

The general contract for the equals(Object) and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or none of them.

Parameters
o the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.
See Also

public String getHost ()

Returns
  • the host

public int getPort ()

Returns
  • the port

public String getRealm ()

Returns
  • the realm name

public String getScheme ()

Returns
  • the scheme type

public int hashCode ()

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Returns
  • this object's hash code.
See Also

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.

public String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation simply concatenates the class name, the '@' sign and a hexadecimal representation of the object's hashCode(), that is, it is equivalent to the following expression:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a printable representation of this object.
See Also