Package org.apache.http.auth
Class AuthScope
- java.lang.Object
-
- org.apache.http.auth.AuthScope
-
@Contract(threading=IMMUTABLE) public class AuthScope extends java.lang.Object
AuthScope
represents an authentication scope consisting of a host name, a port number, a realm name and an authentication scheme name.This class can also optionally contain a host of origin, if created in response to authentication challenge from a specific host.
- Since:
- 4.0
-
-
Field Summary
Fields Modifier and Type Field Description static AuthScope
ANY
Default scope matching any host, port, realm and authentication scheme.static java.lang.String
ANY_HOST
Thenull
value represents any host.static int
ANY_PORT
The-1
value represents any port.static java.lang.String
ANY_REALM
Thenull
value represents any realm.static java.lang.String
ANY_SCHEME
Thenull
value represents any authentication scheme.
-
Constructor Summary
Constructors Constructor Description AuthScope(java.lang.String host, int port)
Defines auth scope with the givenhost
andport
.AuthScope(java.lang.String host, int port, java.lang.String realm)
Defines auth scope with the givenhost
,port
andrealm
.AuthScope(java.lang.String host, int port, java.lang.String realm, java.lang.String schemeName)
Defines auth scope with the givenhost
,port
,realm
, andschemeName
.AuthScope(AuthScope authscope)
Creates a copy of the given credentials scope.AuthScope(HttpHost origin)
Defines auth scope for a specific host of origin.AuthScope(HttpHost origin, java.lang.String realm, java.lang.String schemeName)
Defines auth scope for a specific host of origin.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
java.lang.String
getHost()
HttpHost
getOrigin()
int
getPort()
java.lang.String
getRealm()
java.lang.String
getScheme()
int
hashCode()
int
match(AuthScope that)
Tests if the authentication scopes match.java.lang.String
toString()
-
-
-
Field Detail
-
ANY_HOST
public static final java.lang.String ANY_HOST
Thenull
value represents any host. In the future versions of HttpClient the use of this parameter will be discontinued.
-
ANY_PORT
public static final int ANY_PORT
The-1
value represents any port.- See Also:
- Constant Field Values
-
ANY_REALM
public static final java.lang.String ANY_REALM
Thenull
value represents any realm.
-
ANY_SCHEME
public static final java.lang.String ANY_SCHEME
Thenull
value represents any authentication scheme.
-
ANY
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.
-
-
Constructor Detail
-
AuthScope
public AuthScope(java.lang.String host, int port, java.lang.String realm, java.lang.String schemeName)
Defines auth scope with the givenhost
,port
,realm
, andschemeName
.- Parameters:
host
- authentication host. May beANY_HOST
if applies to any host.port
- authentication port. May beANY_PORT
if applies to any port of the host.realm
- authentication realm. May beANY_REALM
if applies to any realm on the host.schemeName
- authentication scheme. May beANY_SCHEME
if applies to any scheme supported by the host.
-
AuthScope
public AuthScope(HttpHost origin, java.lang.String realm, java.lang.String schemeName)
Defines auth scope for a specific host of origin.- Parameters:
origin
- host of originrealm
- authentication realm. May beANY_REALM
if applies to any realm on the host.schemeName
- authentication scheme. May beANY_SCHEME
if applies to any scheme supported by the host.- Since:
- 4.2
-
AuthScope
public AuthScope(HttpHost origin)
Defines auth scope for a specific host of origin.- Parameters:
origin
- host of origin- Since:
- 4.2
-
AuthScope
public AuthScope(java.lang.String host, int port, java.lang.String realm)
Defines auth scope with the givenhost
,port
andrealm
.
-
AuthScope
public AuthScope(java.lang.String host, int port)
Defines auth scope with the givenhost
andport
.
-
AuthScope
public AuthScope(AuthScope authscope)
Creates a copy of the given credentials scope.
-
-
Method Detail
-
getOrigin
public HttpHost getOrigin()
- Returns:
- host of origin. If unknown returns @null,
- Since:
- 4.4
-
getHost
public java.lang.String getHost()
- Returns:
- the host
-
getPort
public int getPort()
- Returns:
- the port
-
getRealm
public java.lang.String getRealm()
- Returns:
- the realm name
-
getScheme
public java.lang.String getScheme()
- Returns:
- the scheme type
-
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(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
- See Also:
Object.equals(Object)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- See Also:
Object.toString()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
- See Also:
Object.hashCode()
-
-