Package org.apache.http.auth
Class AuthScope
java.lang.Object
org.apache.http.auth.AuthScope
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
FieldsModifier and TypeFieldDescriptionstatic final AuthScope
Default scope matching any host, port, realm and authentication scheme.static final String
Thenull
value represents any host.static final int
The-1
value represents any port.static final String
Thenull
value represents any realm.static final String
Thenull
value represents any authentication scheme. -
Constructor Summary
ConstructorsConstructorDescriptionDefines auth scope with the givenhost
andport
.Defines auth scope with the givenhost
,port
andrealm
.Defines auth scope with the givenhost
,port
,realm
, andschemeName
.Creates a copy of the given credentials scope.AuthScope
(org.apache.http.HttpHost origin) Defines auth scope for a specific host of origin.Defines auth scope for a specific host of origin. -
Method Summary
-
Field Details
-
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_PORTThe-1
value represents any port.- See Also:
-
ANY_REALM
Thenull
value represents any realm. -
ANY_SCHEME
Thenull
value represents any authentication scheme. -
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 Details
-
AuthScope
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
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(org.apache.http.HttpHost origin) Defines auth scope for a specific host of origin.- Parameters:
origin
- host of origin- Since:
- 4.2
-
AuthScope
Defines auth scope with the givenhost
,port
andrealm
. -
AuthScope
Defines auth scope with the givenhost
andport
. -
AuthScope
Creates a copy of the given credentials scope.
-
-
Method Details
-
getOrigin
public org.apache.http.HttpHost getOrigin()- Returns:
- host of origin. If unknown returns @null,
- Since:
- 4.4
-
getHost
- Returns:
- the host
-
getPort
public int getPort()- Returns:
- the port
-
getRealm
- Returns:
- the realm name
-
getScheme
- Returns:
- the scheme type
-
match
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
-
toString
-
hashCode
public int hashCode()
-