Class AuthorizationInfo
- java.lang.Object
-
- org.sblim.cimclient.internal.http.AuthorizationInfo
-
- Direct Known Subclasses:
PegasusLocalAuthInfo
,WwwAuthInfo
public abstract class AuthorizationInfo extends java.lang.Object
Abstract superclass for HTTP authorization information.- See Also:
WwwAuthInfo
,PegasusLocalAuthInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
iA1
protected java.lang.String
iAddr
protected java.lang.String
iAlgorithm
protected java.lang.String
iCnonce
protected java.net.PasswordAuthentication
iCredentials
protected long
iNc
protected java.lang.String
iNonce
protected java.lang.String
iOpaque
protected int
iPort
protected java.lang.String
iProtocol
protected java.lang.String
iQop
protected java.lang.String
iRealm
protected java.lang.String
iResponse
protected java.lang.String
iScheme
protected java.lang.String
iUri
-
Constructor Summary
Constructors Constructor Description AuthorizationInfo()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static AuthorizationInfo
createAuthorizationInfo(java.lang.String pModule)
Factory method for AuthorizationInfo objects.static AuthorizationInfo
createAuthorizationInfo(java.lang.String pModule, java.lang.Boolean pProxy, java.lang.String pAddress, int pPort, java.lang.String pProtocol, java.lang.String pRealm, java.lang.String pScheme)
Factory method for AuthorizationInfo objects.java.lang.String
getA1()
Returns A1java.lang.String
getAddr()
Returns the addressjava.lang.String
getAlgorithm()
Returns algorithmjava.lang.String
getCnonce()
Returns cnoncejava.net.PasswordAuthentication
getCredentials()
Returns the credentialsabstract java.lang.String
getHeaderFieldName()
Gets the HTTP header field name for this authentication informationlong
getNc()
Returns ncjava.lang.String
getNonce()
Returns noncejava.lang.String
getOpaque()
Returns opaqueint
getPort()
Returns the portjava.lang.String
getProtocol()
Returns the protocoljava.lang.String
getQop()
Returns Qopjava.lang.String
getRealm()
Returns the realmjava.lang.String
getResponse()
Returns responsejava.lang.String
getScheme()
Returns the schemejava.lang.String
getURI()
Returns URIvoid
init(java.lang.Boolean pProxy, java.lang.String pAddress, int pPort, java.lang.String pProtocol, java.lang.String pRealm, java.lang.String pScheme)
Initializeabstract boolean
isKeptAlive()
Determines if the connection is kept alive after the "401 Unauthorized" responseabstract boolean
isSentOnFirstRequest()
Determines if the authorization information is already sent on the very first http request or after the "401 Unauthorized" responseboolean
match(java.lang.Object obj)
Compares two authorization informations.void
setA1(java.lang.String A1)
Sets A1void
setAlgorithm(java.lang.String algorithm)
Set algorithmvoid
setCnonce(java.lang.String cnonce)
Set cnoncevoid
setCredentials(java.net.PasswordAuthentication credentials)
Sets credentialsvoid
setNc(long nc)
Sets ncvoid
setNonce(java.lang.String nonce)
Sets noncevoid
setOpaque(java.lang.String opaque)
Sets opaquevoid
setQop(java.lang.String qop)
Sets Qopvoid
setRealm(java.lang.String realm)
Sets the realmvoid
setResponse(java.lang.String response)
Sets responsevoid
setScheme(java.lang.String scheme)
Sets the schemevoid
setURI(java.lang.String uri)
Sets URIabstract java.lang.String
toString()
abstract void
updateAuthenticationInfo(Challenge challenge, java.lang.String authenticate, java.net.URI url, java.lang.String requestMethod)
Updates the authorization information according to a received challenge.
-
-
-
Field Detail
-
iAddr
protected java.lang.String iAddr
-
iPort
protected int iPort
-
iProtocol
protected java.lang.String iProtocol
-
iRealm
protected java.lang.String iRealm
-
iScheme
protected java.lang.String iScheme
-
iCredentials
protected java.net.PasswordAuthentication iCredentials
-
iNc
protected long iNc
-
iCnonce
protected java.lang.String iCnonce
-
iOpaque
protected java.lang.String iOpaque
-
iAlgorithm
protected java.lang.String iAlgorithm
-
iUri
protected java.lang.String iUri
-
iNonce
protected java.lang.String iNonce
-
iQop
protected java.lang.String iQop
-
iA1
protected java.lang.String iA1
-
iResponse
protected java.lang.String iResponse
-
-
Method Detail
-
init
public void init(java.lang.Boolean pProxy, java.lang.String pAddress, int pPort, java.lang.String pProtocol, java.lang.String pRealm, java.lang.String pScheme)
Initialize- Parameters:
pProxy
- Proxy authentication ?pAddress
- Server addresspPort
- Server portpProtocol
- ProtocolpRealm
- RealmpScheme
- Scheme
-
setOpaque
public void setOpaque(java.lang.String opaque)
Sets opaque- Parameters:
opaque
- new Value
-
getOpaque
public java.lang.String getOpaque()
Returns opaque- Returns:
- Opaque
-
getQop
public java.lang.String getQop()
Returns Qop- Returns:
- Qop
-
setQop
public void setQop(java.lang.String qop)
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
public void setNonce(java.lang.String nonce)
Sets nonce- Parameters:
nonce
- New Value
-
getNonce
public java.lang.String getNonce()
Returns nonce- Returns:
- nonce
-
setCnonce
public void setCnonce(java.lang.String cnonce)
Set cnonce- Parameters:
cnonce
- New value
-
getCnonce
public java.lang.String getCnonce()
Returns cnonce- Returns:
- cnonce
-
setAlgorithm
public void setAlgorithm(java.lang.String algorithm)
Set algorithm- Parameters:
algorithm
- New value
-
getAlgorithm
public java.lang.String getAlgorithm()
Returns algorithm- Returns:
- algorithm
-
getA1
public java.lang.String getA1()
Returns A1- Returns:
- A1
-
setA1
public void setA1(java.lang.String A1)
Sets A1- Parameters:
A1
- New value
-
setResponse
public void setResponse(java.lang.String response)
Sets response- Parameters:
response
- New value
-
getResponse
public java.lang.String getResponse()
Returns response- Returns:
- New value
-
getURI
public java.lang.String getURI()
Returns URI- Returns:
- URI
-
setURI
public void setURI(java.lang.String uri)
Sets URI- Parameters:
uri
- New value
-
setCredentials
public void setCredentials(java.net.PasswordAuthentication credentials)
Sets credentials- Parameters:
credentials
- New value
-
getAddr
public java.lang.String getAddr()
Returns the address- Returns:
- The server address
-
getPort
public int getPort()
Returns the port- Returns:
- The server port
-
getProtocol
public java.lang.String getProtocol()
Returns the protocol- Returns:
- The protocol
-
getRealm
public java.lang.String getRealm()
Returns the realm- Returns:
- The realm
-
setRealm
public void setRealm(java.lang.String realm)
Sets the realm- Parameters:
realm
- New value
-
getScheme
public java.lang.String getScheme()
Returns the scheme- Returns:
- The scheme
-
setScheme
public void setScheme(java.lang.String scheme)
Sets the scheme- Parameters:
scheme
- New value
-
getCredentials
public java.net.PasswordAuthentication getCredentials()
Returns the credentials- Returns:
- The credentials
-
match
public boolean match(java.lang.Object obj)
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, java.lang.String authenticate, java.net.URI url, java.lang.String requestMethod) throws java.security.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:
java.security.NoSuchAlgorithmException
-
toString
public abstract java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getHeaderFieldName
public abstract java.lang.String 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(java.lang.String pModule, java.lang.Boolean pProxy, java.lang.String pAddress, int pPort, java.lang.String pProtocol, java.lang.String pRealm, java.lang.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:
WBEMConfiguration.getHttpAuthenticationModule()
,WwwAuthInfo
,PegasusLocalAuthInfo
-
createAuthorizationInfo
public static AuthorizationInfo createAuthorizationInfo(java.lang.String pModule)
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
-
-