All Packages Class Hierarchy This Package Previous Next Index
Class HTTPClient.AuthorizationInfo
java.lang.Object
|
+----HTTPClient.AuthorizationInfo
- public class AuthorizationInfo
- extends Object
- implements GlobalConstants
Holds the information for an authorization response.
- Version:
- 0.3 30/01/1998
- Author:
- Ronald Tschalär
-
AuthorizationInfo(String, int, String, String, NVPair[], Object)
- Creates a new info structure for the specified host and port with the
specified scheme, realm, params.
-
AuthorizationInfo(String, int, String, String, String)
- Creates a new info structure for the specified host and port with the
specified scheme, realm and "basic" cookie.
-
addAuthorization(AuthorizationInfo)
- Adds an authorization entry to the list using the default context.
-
addAuthorization(AuthorizationInfo, Object)
- Adds an authorization entry to the list.
-
addAuthorization(String, int, String, String, String, NVPair[], Object)
- Adds an authorization entry to the list using the default context.
-
addAuthorization(String, int, String, String, String, NVPair[], Object, Object)
- Adds an authorization entry to the list.
-
addBasicAuthorization(String, int, String, String, String)
- Adds an authorization entry for the "basic" authorization scheme to
the list using the default context.
-
addBasicAuthorization(String, int, String, String, String, Object)
- Adds an authorization entry for the "basic" authorization scheme to
the list.
-
addDigestAuthorization(String, int, String, String, String)
- Adds an authorization entry for the "digest" authorization scheme to
the list using the default context.
-
addDigestAuthorization(String, int, String, String, String, Object)
- Adds an authorization entry for the "digest" authorization scheme to
the list.
-
equals(Object)
- Two AuthorizationInfos are considered equal if their Host, Port,
Scheme and Realm match.
-
getAuthHandler()
- Get's the current authorization handler.
-
getAuthorization(String, int, String, String)
- Searches for the authorization info using the given host, port,
scheme and realm.
-
getAuthorization(String, int, String, String, Object)
- Searches for the authorization info in the given context using the
given host, port, scheme and realm.
-
getExtraInfo()
- Get the extra info.
-
getHost()
- Get the host.
-
getParams()
- Get the authentication parameters.
-
getPort()
- Get the port.
-
getRealm()
- Get the realm.
-
getScheme()
- Get the scheme.
-
hashCode()
- Produces a hash code based on Host, Scheme and Realm.
-
removeAuthorization(AuthorizationInfo)
- Removes an authorization entry from the list using the default context.
-
removeAuthorization(AuthorizationInfo, Object)
- Removes an authorization entry from the list.
-
removeAuthorization(String, int, String, String)
- Removes an authorization entry from the list using the default context.
-
removeAuthorization(String, int, String, String, Object)
- Removes an authorization entry from the list.
-
setAuthHandler(AuthorizationHandler)
- Set's the authorization handler.
-
setExtraInfo(Object)
- Set the extra info.
-
setParams(NVPair[])
- Set the authentication parameters.
-
toString()
- Constructs a string containing the authorization info.
AuthorizationInfo
public AuthorizationInfo(String host,
int port,
String scheme,
String realm,
NVPair[] params,
Object info)
- Creates a new info structure for the specified host and port with the
specified scheme, realm, params. The "basic" cookie is set to null.
- Parameters:
- host - the host
- port - the port
- scheme - the scheme
- realm - the realm
- params - the parameters as an array of name/value pairs, or null
- info - arbitrary extra info, or null
AuthorizationInfo
public AuthorizationInfo(String host,
int port,
String scheme,
String realm,
String cookie)
- Creates a new info structure for the specified host and port with the
specified scheme, realm and "basic" cookie. The params is set to
a zero-length array, and the extra_info is set to null.
- Parameters:
- host - the host
- port - the port
- scheme - the scheme
- realm - the realm
- cookie - the encoded username/password for the "basic" scheme
setAuthHandler
public static AuthorizationHandler setAuthHandler(AuthorizationHandler handler)
- Set's the authorization handler. This handler is called whenever
the server requests authorization and no entry for the requested
scheme and realm can be found in the list. The handler must implement
the AuthorizationHandler interface.
If no handler is set then a default handler is used. This handler
currently only handles the "basic" scheme and brings up a popup which
prompts for the username and password.
The default handler can be disabled by setting the auth handler
to null.
- Parameters:
- handler - the new authorization handler
- Returns:
- the old authorization handler
- See Also:
- AuthorizationHandler
getAuthHandler
public static AuthorizationHandler getAuthHandler()
- Get's the current authorization handler.
- Returns:
- the current authorization handler, or null if none is set.
- See Also:
- AuthorizationHandler
getAuthorization
public static AuthorizationInfo getAuthorization(String host,
int port,
String scheme,
String realm)
- Searches for the authorization info using the given host, port,
scheme and realm. The context is the default context.
- Parameters:
- host - the host
- port - the port
- scheme - the scheme
- realm - the realm
- Returns:
- a pointer to the authorization data or null if not found
getAuthorization
public static AuthorizationInfo getAuthorization(String host,
int port,
String scheme,
String realm,
Object context)
- Searches for the authorization info in the given context using the
given host, port, scheme and realm.
- Parameters:
- host - the host
- port - the port
- scheme - the scheme
- realm - the realm
- context - the context this info is associated with
- Returns:
- a pointer to the authorization data or null if not found
addAuthorization
public static void addAuthorization(AuthorizationInfo auth_info)
- Adds an authorization entry to the list using the default context.
If an entry for the specified scheme and realm already exists then
its cookie and params are replaced with the new data.
- Parameters:
- auth_info - the AuthorizationInfo to add
addAuthorization
public static void addAuthorization(AuthorizationInfo auth_info,
Object context)
- Adds an authorization entry to the list. If an entry for the
specified scheme and realm already exists then its cookie and
params are replaced with the new data.
- Parameters:
- auth_info - the AuthorizationInfo to add
- context - the context to associate this info with
addAuthorization
public static void addAuthorization(String host,
int port,
String scheme,
String realm,
String cookie,
NVPair[] params,
Object info)
- Adds an authorization entry to the list using the default context.
If an entry for the specified scheme and realm already exists then
its cookie and params are replaced with the new data.
- Parameters:
- host - the host
- port - the port
- scheme - the scheme
- realm - the realm
- cookie - the string used for the "basic" authorization scheme
- params - an array of name/value pairs of parameters
- info - arbitrary extra auth info
addAuthorization
public static void addAuthorization(String host,
int port,
String scheme,
String realm,
String cookie,
NVPair[] params,
Object info,
Object context)
- Adds an authorization entry to the list. If an entry for the
specified scheme and realm already exists then its cookie and
params are replaced with the new data.
- Parameters:
- host - the host
- port - the port
- scheme - the scheme
- realm - the realm
- cookie - the string used for the "basic" authorization scheme
- params - an array of name/value pairs of parameters
- info - arbitrary extra auth info
- context - the context to associate this info with
addBasicAuthorization
public static void addBasicAuthorization(String host,
int port,
String realm,
String user,
String passwd)
- Adds an authorization entry for the "basic" authorization scheme to
the list using the default context. If an entry already exists for
the "basic" scheme and the specified realm then it is overwritten.
- Parameters:
- host - the host
- port - the port
- realm - the realm
- user - the username
- passwd - the password
addBasicAuthorization
public static void addBasicAuthorization(String host,
int port,
String realm,
String user,
String passwd,
Object context)
- Adds an authorization entry for the "basic" authorization scheme to
the list. If an entry already exists for the "basic" scheme and the
specified realm then it is overwritten.
- Parameters:
- host - the host
- port - the port
- realm - the realm
- user - the username
- passwd - the password
- context - the context to associate this info with
addDigestAuthorization
public static void addDigestAuthorization(String host,
int port,
String realm,
String user,
String passwd)
- Adds an authorization entry for the "digest" authorization scheme to
the list using the default context. If an entry already exists for the
"digest" scheme and the specified realm then it is overwritten.
- Parameters:
- host - the host
- port - the port
- realm - the realm
- user - the username
- passwd - the password
addDigestAuthorization
public static void addDigestAuthorization(String host,
int port,
String realm,
String user,
String passwd,
Object context)
- Adds an authorization entry for the "digest" authorization scheme to
the list. If an entry already exists for the "digest" scheme and the
specified realm then it is overwritten.
- Parameters:
- host - the host
- port - the port
- realm - the realm
- user - the username
- passwd - the password
- context - the context to associate this info with
removeAuthorization
public static void removeAuthorization(AuthorizationInfo auth_info)
- Removes an authorization entry from the list using the default context.
If no entry for the specified host, port, scheme and realm exists then
this does nothing.
- Parameters:
- auth_info - the AuthorizationInfo to remove
removeAuthorization
public static void removeAuthorization(AuthorizationInfo auth_info,
Object context)
- Removes an authorization entry from the list. If no entry for the
specified host, port, scheme and realm exists then this does nothing.
- Parameters:
- auth_info - the AuthorizationInfo to remove
- context - the context this info is associated with
removeAuthorization
public static void removeAuthorization(String host,
int port,
String scheme,
String realm)
- Removes an authorization entry from the list using the default context.
If no entry for the specified host, port, scheme and realm exists then
this does nothing.
- Parameters:
- host - the host
- port - the port
- scheme - the scheme
- realm - the realm
removeAuthorization
public static void removeAuthorization(String host,
int port,
String scheme,
String realm,
Object context)
- Removes an authorization entry from the list. If no entry for the
specified host, port, scheme and realm exists then this does nothing.
- Parameters:
- host - the host
- port - the port
- scheme - the scheme
- realm - the realm
- context - the context this info is associated with
getHost
public final String getHost()
- Get the host.
- Returns:
- a string containing the host name.
getPort
public final int getPort()
- Get the port.
- Returns:
- an int containing the port number.
getScheme
public final String getScheme()
- Get the scheme.
- Returns:
- a string containing the scheme.
getRealm
public final String getRealm()
- Get the realm.
- Returns:
- a string containing the realm.
getParams
public final NVPair[] getParams()
- Get the authentication parameters.
- Returns:
- an array of name/value pairs.
setParams
public final void setParams(NVPair[] params)
- Set the authentication parameters.
- Parameters:
- an - array of name/value pairs.
getExtraInfo
public final Object getExtraInfo()
- Get the extra info.
- Returns:
- the extra_info object
setExtraInfo
public final void setExtraInfo(Object info)
- Set the extra info.
- Parameters:
- info - the extra info
toString
public String toString()
- Constructs a string containing the authorization info. The format
is that of the http Authorization header.
- Returns:
- a String containing all info.
- Overrides:
- toString in class Object
hashCode
public int hashCode()
- Produces a hash code based on Host, Scheme and Realm. Port is not
included for simplicity (and because it probably won't make much
difference). Used in the AuthorizationInfo.AuthList hash table.
- Returns:
- the hash code
- Overrides:
- hashCode in class Object
equals
public boolean equals(Object obj)
- Two AuthorizationInfos are considered equal if their Host, Port,
Scheme and Realm match. Used in the AuthorizationInfo.AuthList hash
table.
- Parameters:
- obj - another AuthorizationInfo against which this one is
to be compared.
- Returns:
- true if they match in the above mentioned fields; false
otherwise.
- Overrides:
- equals in class Object
All Packages Class Hierarchy This Package Previous Next Index