Class AuthorizationInfo
java.lang.Object
org.sblim.cimclient.internal.http.AuthorizationInfo
- Direct Known Subclasses:
PegasusLocalAuthInfo
,WwwAuthInfo
Abstract superclass for HTTP authorization information.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
protected String
protected String
protected String
protected PasswordAuthentication
protected long
protected String
protected String
protected int
protected String
protected String
protected String
protected String
protected String
protected String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AuthorizationInfo
createAuthorizationInfo
(String pModule) Factory method for AuthorizationInfo objects.static AuthorizationInfo
createAuthorizationInfo
(String pModule, Boolean pProxy, String pAddress, int pPort, String pProtocol, String pRealm, String pScheme) Factory method for AuthorizationInfo objects.getA1()
Returns A1getAddr()
Returns the addressReturns algorithmReturns cnonceReturns the credentialsabstract String
Gets the HTTP header field name for this authentication informationlong
getNc()
Returns ncgetNonce()
Returns nonceReturns opaqueint
getPort()
Returns the portReturns the protocolgetQop()
Returns QopgetRealm()
Returns the realmReturns responseReturns the schemegetURI()
Returns URIvoid
Initializeabstract boolean
Determines if the connection is kept alive after the "401 Unauthorized" responseabstract boolean
Determines if the authorization information is already sent on the very first http request or after the "401 Unauthorized" responseboolean
Compares two authorization informations.void
Sets A1void
setAlgorithm
(String algorithm) Set algorithmvoid
Set cnoncevoid
setCredentials
(PasswordAuthentication credentials) Sets credentialsvoid
setNc
(long nc) Sets ncvoid
Sets noncevoid
Sets opaquevoid
Sets Qopvoid
Sets the realmvoid
setResponse
(String response) Sets responsevoid
Sets the schemevoid
Sets URIabstract String
toString()
abstract void
updateAuthenticationInfo
(Challenge challenge, String authenticate, URI url, String requestMethod) Updates the authorization information according to a received challenge.
-
Field Details
-
iAddr
-
iPort
protected int iPort -
iProtocol
-
iRealm
-
iScheme
-
iCredentials
-
iNc
protected long iNc -
iCnonce
-
iOpaque
-
iAlgorithm
-
iUri
-
iNonce
-
iQop
-
iA1
-
iResponse
-
-
Constructor Details
-
AuthorizationInfo
public AuthorizationInfo()
-
-
Method Details
-
init
public void init(Boolean pProxy, String pAddress, int pPort, String pProtocol, String pRealm, String pScheme) Initialize- Parameters:
pProxy
- Proxy authentication ?pAddress
- Server addresspPort
- Server portpProtocol
- ProtocolpRealm
- RealmpScheme
- Scheme
-
setOpaque
Sets opaque- Parameters:
opaque
- new Value
-
getOpaque
Returns opaque- Returns:
- Opaque
-
getQop
Returns Qop- Returns:
- Qop
-
setQop
Sets Qop- Parameters:
qop
- New value
-
getNc
public long getNc()Returns nc- Returns:
- nc
-
setNc
public void setNc(long nc) Sets nc- Parameters:
nc
- New value
-
setNonce
Sets nonce- Parameters:
nonce
- New Value
-
getNonce
Returns nonce- Returns:
- nonce
-
setCnonce
Set cnonce- Parameters:
cnonce
- New value
-
getCnonce
Returns cnonce- Returns:
- cnonce
-
setAlgorithm
Set algorithm- Parameters:
algorithm
- New value
-
getAlgorithm
Returns algorithm- Returns:
- algorithm
-
getA1
Returns A1- Returns:
- A1
-
setA1
Sets A1- Parameters:
A1
- New value
-
setResponse
Sets response- Parameters:
response
- New value
-
getResponse
Returns response- Returns:
- New value
-
getURI
Returns URI- Returns:
- URI
-
setURI
Sets URI- Parameters:
uri
- New value
-
setCredentials
Sets credentials- Parameters:
credentials
- New value
-
getAddr
Returns the address- Returns:
- The server address
-
getPort
public int getPort()Returns the port- Returns:
- The server port
-
getProtocol
Returns the protocol- Returns:
- The protocol
-
getRealm
Returns the realm- Returns:
- The realm
-
setRealm
Sets the realm- Parameters:
realm
- New value
-
getScheme
Returns the scheme- Returns:
- The scheme
-
setScheme
Sets the scheme- Parameters:
scheme
- New value
-
getCredentials
Returns the credentials- Returns:
- The credentials
-
match
Compares two authorization informations.- Parameters:
obj
- The other authorization information- Returns:
true
if type, realm, scheme, address, protocol and port of both authorization informations are equal,false
otherwise.
-
updateAuthenticationInfo
public abstract void updateAuthenticationInfo(Challenge challenge, String authenticate, URI url, String requestMethod) throws NoSuchAlgorithmException Updates the authorization information according to a received challenge.- Parameters:
challenge
- The received challengeauthenticate
- The authenticate header fieldurl
- The url of the CIM serverrequestMethod
- The HTTP request method (POST or MPOST)- Throws:
NoSuchAlgorithmException
-
toString
-
getHeaderFieldName
Gets the HTTP header field name for this authentication information- Returns:
- The field name
-
isSentOnFirstRequest
public abstract boolean isSentOnFirstRequest()Determines if the authorization information is already sent on the very first http request or after the "401 Unauthorized" response- Returns:
true
orfalse
-
isKeptAlive
public abstract boolean isKeptAlive()Determines if the connection is kept alive after the "401 Unauthorized" response- Returns:
true
orfalse
-
createAuthorizationInfo
public static AuthorizationInfo createAuthorizationInfo(String pModule, Boolean pProxy, String pAddress, int pPort, String pProtocol, String pRealm, String pScheme) Factory method for AuthorizationInfo objects. Returns an instance of a subclass according to the requested type.- Parameters:
pModule
- The authorization info type to be constructedpProxy
- Proxy authentication ?pAddress
- Server addresspPort
- Server portpProtocol
- Protocol (http/https)pRealm
- RealmpScheme
- Scheme (e.g. Basic, Digest)- Returns:
- An instance of a AuthorizationInfo subclass or
null
- See Also:
-
createAuthorizationInfo
Factory method for AuthorizationInfo objects. Returns an instance of a subclass according to the requested type.- Parameters:
pModule
- The authorization info type to be constructed- Returns:
- An instance of a AuthorizationInfo subclass or
null
-