|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.httpgw.AuthHandler
A simple authorization handler that throws up a message box requesting both a username and password. This is default authorization handler. Currently only handles the authentication types "Basic" and "SOCKS5" (used for the SocksClient and not part of HTTP per se). This code is heavily based on 'MyAuthHandler' -- a part of the HTTPClient package.
Field Summary | |
private BasicAuthBox |
inp
|
private String |
password
|
private static String |
RESOURCE
|
private String |
userName
|
Constructor Summary | |
AuthHandler()
|
Method Summary | |
static String |
ByteToHex(byte[] hash)
Turns array of bytes into string representing each byte as unsigned hex number. |
private static String |
calc_digest(HTTPClient.RoRequest req,
String A1_hash,
String nonce)
Calculates the digest of the request body. |
HTTPClient.AuthorizationInfo |
fixupAuthInfo(HTTPClient.AuthorizationInfo info,
HTTPClient.RoRequest req,
HTTPClient.AuthorizationInfo challenge,
HTTPClient.RoResponse resp)
For Digest authentication we need to set the uri, response and opaque parameters. |
HTTPClient.AuthorizationInfo |
getAuthorization(HTTPClient.AuthorizationInfo challenge,
HTTPClient.RoRequest req,
HTTPClient.RoResponse resp)
returns the requested authorization, or null if none was given. |
private static void |
handle_digest(HTTPClient.AuthorizationInfo prev,
HTTPClient.Response resp,
HTTPClient.RoRequest req)
Handle digest field of the Authentication-Info response header. |
private static void |
handle_discard(HTTPClient.AuthorizationInfo prev,
HTTPClient.HttpHeaderElement discard)
Handle discard token |
private static void |
handle_nextnonce(HTTPClient.AuthorizationInfo prev,
HTTPClient.HttpHeaderElement nextnonce)
Handle nextnonce field. |
void |
handleAuthHeaders(HTTPClient.Response resp,
HTTPClient.RoRequest req,
HTTPClient.AuthorizationInfo prev,
HTTPClient.AuthorizationInfo prxy)
We handle the "Authentication-info" and "Proxy-Authentication-info" headers here. |
private static void |
handleAuthInfo(String auth_info,
String prxy_info,
HTTPClient.AuthorizationInfo prev,
HTTPClient.AuthorizationInfo prxy,
HTTPClient.Response resp,
HTTPClient.RoRequest req,
boolean in_headers)
|
void |
handleAuthTrailers(HTTPClient.Response resp,
HTTPClient.RoRequest req,
HTTPClient.AuthorizationInfo prev,
HTTPClient.AuthorizationInfo prxy)
We handle the "Authentication-info" and "Proxy-Authentication-info" trailers here. |
(package private) static HTTPClient.NVPair[] |
resizeArray(HTTPClient.NVPair[] src,
int new_size)
|
void |
setPassword(String password)
|
void |
setUserName(String user_name)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private BasicAuthBox inp
private static final String RESOURCE
private String userName
private String password
Constructor Detail |
public AuthHandler()
Method Detail |
public void setUserName(String user_name)
public void setPassword(String password)
public HTTPClient.AuthorizationInfo fixupAuthInfo(HTTPClient.AuthorizationInfo info, HTTPClient.RoRequest req, HTTPClient.AuthorizationInfo challenge, HTTPClient.RoResponse resp) throws HTTPClient.AuthSchemeNotImplException
fixupAuthInfo
in interface HTTPClient.AuthorizationHandler
HTTPClient.AuthSchemeNotImplException
public HTTPClient.AuthorizationInfo getAuthorization(HTTPClient.AuthorizationInfo challenge, HTTPClient.RoRequest req, HTTPClient.RoResponse resp) throws HTTPClient.AuthSchemeNotImplException
getAuthorization
in interface HTTPClient.AuthorizationHandler
challenge
- the parsed challenge from the server.req
- the request which solicited this responseresp
- the full response received
HTTPClient.AuthSchemeNotImplException
- if the authentication scheme
in the challenge cannot be handled.public void handleAuthHeaders(HTTPClient.Response resp, HTTPClient.RoRequest req, HTTPClient.AuthorizationInfo prev, HTTPClient.AuthorizationInfo prxy) throws IOException
handleAuthHeaders
in interface HTTPClient.AuthorizationHandler
IOException
public void handleAuthTrailers(HTTPClient.Response resp, HTTPClient.RoRequest req, HTTPClient.AuthorizationInfo prev, HTTPClient.AuthorizationInfo prxy) throws IOException
handleAuthTrailers
in interface HTTPClient.AuthorizationHandler
IOException
private static void handleAuthInfo(String auth_info, String prxy_info, HTTPClient.AuthorizationInfo prev, HTTPClient.AuthorizationInfo prxy, HTTPClient.Response resp, HTTPClient.RoRequest req, boolean in_headers) throws HTTPClient.ParseException, IOException
HTTPClient.ParseException
IOException
private static void handle_nextnonce(HTTPClient.AuthorizationInfo prev, HTTPClient.HttpHeaderElement nextnonce)
private static void handle_digest(HTTPClient.AuthorizationInfo prev, HTTPClient.Response resp, HTTPClient.RoRequest req) throws IOException
IOException
private static String calc_digest(HTTPClient.RoRequest req, String A1_hash, String nonce)
private static void handle_discard(HTTPClient.AuthorizationInfo prev, HTTPClient.HttpHeaderElement discard)
static final HTTPClient.NVPair[] resizeArray(HTTPClient.NVPair[] src, int new_size)
public static String ByteToHex(byte[] hash)
hash
- Array of bytes to convert to hex-string
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |