Package 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 java.lang.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
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
host
private int
port
private java.lang.String
protocol
private java.lang.String
realm
private java.lang.String
schemeName
-
Constructor Summary
Constructors Constructor Description AuthScope(java.lang.String host, int port)
Defines auth scope with the givenhost
andport
.AuthScope(java.lang.String protocol, java.lang.String host, int port, java.lang.String realm, java.lang.String schemeName)
Defines auth scope with the givenprotocol
,host
,port
,realm
, andschemeName
.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, 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 obj)
java.lang.String
getHost()
int
getPort()
java.lang.String
getProtocol()
java.lang.String
getRealm()
java.lang.String
getSchemeName()
int
hashCode()
int
match(AuthScope that)
Tests if the authentication scopes match.java.lang.String
toString()
-
-
-
Constructor Detail
-
AuthScope
public AuthScope(java.lang.String protocol, java.lang.String host, int port, java.lang.String realm, java.lang.String schemeName)
Defines auth scope with the givenprotocol
,host
,port
,realm
, andschemeName
.- Parameters:
protocol
- application protocol. May benull
if applies to any protocol.host
- authentication host. May benull
if applies to any host.port
- authentication port. May be-1
if applies to any port of the host.realm
- authentication realm. May benull
if applies to any realm on the host.schemeName
- authentication scheme name. May benull
if applies to any auth scheme supported by the host.
-
AuthScope
public AuthScope(org.apache.hc.core5.http.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 benull
if applies to any realm on the host.schemeName
- authentication scheme name. May benull
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(java.lang.String host, int port)
Defines auth scope with the givenhost
andport
.- Parameters:
host
- authentication host. May benull
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 java.lang.String getProtocol()
-
getHost
public java.lang.String getHost()
-
getPort
public int getPort()
-
getRealm
public java.lang.String getRealm()
-
getSchemeName
public java.lang.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(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-