HTTPClient
Class SuppliedUPAuthHandler

java.lang.Object
  |
  +--HTTPClient.SuppliedUPAuthHandler
All Implemented Interfaces:
AuthorizationHandler, HTTPClient.GlobalConstants

public class SuppliedUPAuthHandler
extends java.lang.Object
implements AuthorizationHandler, HTTPClient.GlobalConstants

A simple authorization handler that uses the supplied username/password used to create the instance Currently only handles the authentication types "Basic", "Digest".


Field Summary
TypeField
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
SuppliedUPAuthHandler(java.lang.String username, java.lang.String password)
           
 
Method Summary
TypeMethod
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HTTP

public static final int HTTP
possible http protocols we (might) handle

HTTPS

public static final int HTTPS

SHTTP

public static final int SHTTP

HTTP_NG

public static final int HTTP_NG

HTTP_1_0

public static final int HTTP_1_0
some known http versions

HTTP_1_1

public static final int HTTP_1_1

CD_NONE

public static final int CD_NONE
Content delimiters

CD_HDRS

public static final int CD_HDRS

CD_0

public static final int CD_0

CD_CLOSE

public static final int CD_CLOSE

CD_CONTLEN

public static final int CD_CONTLEN

CD_CHUNKED

public static final int CD_CHUNKED

CD_MP_BR

public static final int CD_MP_BR
Constructor Detail

SuppliedUPAuthHandler

public SuppliedUPAuthHandler(java.lang.String username,
                             java.lang.String password)
Method Detail

fixupAuthInfo

public AuthorizationInfo fixupAuthInfo(AuthorizationInfo info,
                                       RoRequest req,
                                       AuthorizationInfo challenge,
                                       RoResponse resp)
                                throws AuthSchemeNotImplException
For Digest authentication we need to set the uri, response and opaque parameters. For "Basic" and "SOCKS5" nothing is done.
Specified by:
fixupAuthInfo in interface AuthorizationHandler
Following copied from interface: HTTPClient.AuthorizationHandler
Parameters:
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.
Returns:
the authorization info to be sent with the request, or null if none is to be sent.
Throws:
AuthSchemeNotImplException - if the authorization scheme in the info cannot be handled.
java.io.IOException - if an exception occurs while fixing up the info

getAuthorization

public AuthorizationInfo getAuthorization(AuthorizationInfo challenge,
                                          RoRequest req,
                                          RoResponse resp)
                                   throws AuthSchemeNotImplException
returns the requested authorization, or null if none was given.
Specified by:
getAuthorization in interface AuthorizationHandler
Parameters:
challenge - the parsed challenge from the server.
req - the request which solicited this response
resp - the full response received
Returns:
a structure containing the necessary authorization info, or null
Throws:
AuthSchemeNotImplException - if the authentication scheme in the challenge cannot be handled.

handleAuthHeaders

public void handleAuthHeaders(Response resp,
                              RoRequest req,
                              AuthorizationInfo prev,
                              AuthorizationInfo prxy)
                       throws java.io.IOException
We handle the "Authentication-Info" and "Proxy-Authentication-Info" headers here.
Specified by:
handleAuthHeaders in interface AuthorizationHandler
Following copied from interface: HTTPClient.AuthorizationHandler
Parameters:
resp - the full Response
req - the Request which provoked this response
prev - the previous auth info sent, or null if none was sent
prxy - the previous proxy auth info sent, or null if none was sent
Throws:
java.io.IOException - if an exception occurs during the reading of the headers.

handleAuthTrailers

public void handleAuthTrailers(Response resp,
                               RoRequest req,
                               AuthorizationInfo prev,
                               AuthorizationInfo prxy)
                        throws java.io.IOException
We handle the "Authentication-Info" and "Proxy-Authentication-Info" trailers here.
Specified by:
handleAuthTrailers in interface AuthorizationHandler
Following copied from interface: HTTPClient.AuthorizationHandler
Parameters:
resp - the full Response
req - the Request which provoked this response
prev - the previous auth info sent, or null if none was sent
prxy - the previous proxy auth info sent, or null if none was sent
Throws:
java.io.IOException - if an exception occurs during the reading of the trailers.
See Also:
AuthorizationHandler.handleAuthHeaders(HTTPClient.Response, HTTPClient.RoRequest, HTTPClient.AuthorizationInfo, HTTPClient.AuthorizationInfo)