|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--HTTPClient.DefaultAuthHandler
This class is the default authorization handler. It currently handles the authentication schemes "Basic", "Digest", and "SOCKS5" (used for the SocksClient and not part of HTTP per se).
By default, when a username and password is required, this handler throws
up a message box requesting the desired info. However, applications can
set their
own authorization prompter
if desired.
Note: all methods except for setAuthorizationPrompter are meant to be invoked by the AuthorizationModule only, i.e. should not be invoked by the application (those methods are only public because implementing the AuthorizationHandler interface requires them to be).
Field Summary | |
static int |
CD_0
|
static int |
CD_CHUNKED
|
static int |
CD_CLOSE
|
static int |
CD_CONTLEN
|
static int |
CD_HDRS
|
static int |
CD_MP_BR
|
static int |
CD_NONE
Content delimiters |
static int |
HTTP
possible http protocols we (might) handle |
static int |
HTTP_1_0
some known http versions |
static int |
HTTP_1_1
|
static int |
HTTP_NG
|
static int |
HTTPS
|
static int |
SHTTP
|
Constructor Summary | |
DefaultAuthHandler()
|
Method Summary | |
AuthorizationInfo |
fixupAuthInfo(AuthorizationInfo info,
RoRequest req,
AuthorizationInfo challenge,
RoResponse resp)
For Digest authentication we need to set the uri, response and opaque parameters. |
AuthorizationInfo |
getAuthorization(AuthorizationInfo challenge,
RoRequest req,
RoResponse resp)
returns the requested authorization, or null if none was given. |
void |
handleAuthHeaders(Response resp,
RoRequest req,
AuthorizationInfo prev,
AuthorizationInfo prxy)
We handle the "Authentication-Info" and "Proxy-Authentication-Info" headers here. |
void |
handleAuthTrailers(Response resp,
RoRequest req,
AuthorizationInfo prev,
AuthorizationInfo prxy)
We handle the "Authentication-Info" and "Proxy-Authentication-Info" trailers here. |
static AuthorizationPrompter |
setAuthorizationPrompter(AuthorizationPrompter prompt)
Set a new username/password prompter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int HTTP
public static final int HTTPS
public static final int SHTTP
public static final int HTTP_NG
public static final int HTTP_1_0
public static final int HTTP_1_1
public static final int CD_NONE
public static final int CD_HDRS
public static final int CD_0
public static final int CD_CLOSE
public static final int CD_CONTLEN
public static final int CD_CHUNKED
public static final int CD_MP_BR
Constructor Detail |
public DefaultAuthHandler()
Method Detail |
public AuthorizationInfo fixupAuthInfo(AuthorizationInfo info, RoRequest req, AuthorizationInfo challenge, RoResponse resp) throws AuthSchemeNotImplException
fixupAuthInfo
in interface AuthorizationHandler
HTTPClient.AuthorizationHandler
info
- the authorization info retrieved from the list of
known info.req
- the request this info is targeted for.challenge
- the authorization challenge received from the server
if this is in response to a 401, or null if we are
preemptively sending the info.resp
- the full 401 response received, or null if we are
preemptively sending the info.AuthSchemeNotImplException
- if the authorization scheme
in the info cannot be handled.java.io.IOException
- if an exception occurs while fixing up the
infopublic AuthorizationInfo getAuthorization(AuthorizationInfo challenge, RoRequest req, RoResponse resp) throws AuthSchemeNotImplException, java.io.IOException
getAuthorization
in interface AuthorizationHandler
challenge
- the parsed challenge from the server.req
- the request which solicited this responseresp
- the full response receivedAuthSchemeNotImplException
- if the authentication scheme
in the challenge cannot be handled.public void handleAuthHeaders(Response resp, RoRequest req, AuthorizationInfo prev, AuthorizationInfo prxy) throws java.io.IOException
handleAuthHeaders
in interface AuthorizationHandler
HTTPClient.AuthorizationHandler
resp
- the full Responsereq
- the Request which provoked this responseprev
- the previous auth info sent, or null if none was sentprxy
- the previous proxy auth info sent, or null if none was sentjava.io.IOException
- if an exception occurs during the reading of
the headers.public void handleAuthTrailers(Response resp, RoRequest req, AuthorizationInfo prev, AuthorizationInfo prxy) throws java.io.IOException
handleAuthTrailers
in interface AuthorizationHandler
HTTPClient.AuthorizationHandler
resp
- the full Responsereq
- the Request which provoked this responseprev
- the previous auth info sent, or null if none was sentprxy
- the previous proxy auth info sent, or null if none was sentjava.io.IOException
- if an exception occurs during the reading of
the trailers.AuthorizationHandler.handleAuthHeaders(HTTPClient.Response, HTTPClient.RoRequest, HTTPClient.AuthorizationInfo, HTTPClient.AuthorizationInfo)
public static AuthorizationPrompter setAuthorizationPrompter(AuthorizationPrompter prompt)
prompt
- the AuthorizationPrompter to use whenever a username
and password are needed; if null, no querying will be
done
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |