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 AuthScopeDefault scope matching any host, port, realm and authentication scheme.static final StringThenullvalue represents any host.static final intThe-1value represents any port.static final StringThenullvalue represents any realm.static final StringThenullvalue represents any authentication scheme.private final StringThe host the credentials apply to.private final org.apache.http.HttpHostThe original host, if knownprivate final intThe port the credentials apply to.private final StringThe realm the credentials apply to.private final StringThe authentication scheme the credentials apply to. -
Constructor Summary
ConstructorsConstructorDescriptionDefines auth scope with the givenhostandport.Defines auth scope with the givenhost,portandrealm.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
Thenullvalue 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-1value represents any port.- See Also:
-
ANY_REALM
Thenullvalue represents any realm. -
ANY_SCHEME
Thenullvalue 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. -
scheme
The authentication scheme the credentials apply to. -
realm
The realm the credentials apply to. -
host
The host the credentials apply to. -
port
private final int portThe port the credentials apply to. -
origin
private final org.apache.http.HttpHost originThe original host, if known
-
-
Constructor Details
-
AuthScope
Defines auth scope with the givenhost,port,realm, andschemeName.- Parameters:
host- authentication host. May beANY_HOSTif applies to any host.port- authentication port. May beANY_PORTif applies to any port of the host.realm- authentication realm. May beANY_REALMif applies to any realm on the host.schemeName- authentication scheme. May beANY_SCHEMEif 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_REALMif applies to any realm on the host.schemeName- authentication scheme. May beANY_SCHEMEif 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,portandrealm. -
AuthScope
Defines auth scope with the givenhostandport. -
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()
-