electric.http.authentication.basic
Class BasicAuthSession

java.lang.Object
  extended byelectric.http.authentication.basic.BasicAuthSession
All Implemented Interfaces:
IAuthSession, IHTTPConstants

public class BasicAuthSession
extends java.lang.Object
implements IAuthSession, IHTTPConstants

Provide HTTP Basic authentication service.

Author:
webMethods

Field Summary
 
Fields inherited from interface electric.util.http.IHTTPConstants
ACCEPT_LANGUAGE, ACCEPT_RANGES, APPLICATION_BINARY, APPLICATION_OCTET_STREAM, ASCII, AUTHORIZATION, BASIC, BOUNDARY, CHARSET_EQUALS, CHUNKED, CLOSE, COLON_SLASH_SLASH, CONNECT, CONNECTION, CONTENT_ID, CONTENT_LANGUAGE, CONTENT_LENGTH, CONTENT_LOCATION, CONTENT_TYPE, CONTINUATION_STATUS, CONTINUE_EXPECTATION, COOKIE, COOKIE_LISTENER, DATE, DEFAULT_CONTENT_TYPE, DEFAULT_HTTP_CHARSET, DEFAULT_HTTPS_PORT, DEFAULT_MIME_TYPE, DEFAULT_PROXY_PORT, DIGEST, EOL, EXPECT, EXPECT_HEADER, FORM_URLENCODED, GET, GLUE_SESSION, HEAD, HOST, HTTP_1_0, HTTP_1_1, HTTP_PROTOCOL, HTTPS_PROTOCOL, IF_MODIFIED_SINCE, KEEP_ALIVE, LAST_MODIFIED, LOCATION, MD5_HASH, MIME_BOUNDARY, MIME_VERSION, MULTIPART_CONTENT_TYPE, OK, POST, PROXY_AUTHORIZATION, RANGE, SC_CONTINUE, SC_MOVED, SC_MOVED_PERMANENTLY, SC_OK, SC_PROXY_AUTHENTICATION_REQUIRED, SC_UNAUTHORIZED, SEPARATOR, SERVER, SERVER_PREFIX, SERVER_TYPE, SET_COOKIE_0, SET_COOKIE_1, SLASH, START, TEXT_HTML, TEXT_PLAIN, TEXT_XML, TEXT_XML_UTF_8, TRANSFER_ENCODING, USER_AGENT, WWW_AUTHENTICATE
 
Constructor Summary
BasicAuthSession()
           
 
Method Summary
 boolean authenticateRealm(XURL host, OutboundHTTPRequest request, AuthHeaderData data)
          Given the data from a WWW-Authenticate challenge header, plus locally maintained state, calculate the appropriate response and add it to the outgoing request.
 PasswordCredentials getCredentials()
           
 AuthHeaderData parseAuthHeader(java.lang.String header)
          Given a WWW-Authenticate challenge header, parse it and return the results as an AuthHeaderData.
 void preAuthenticate(XURL host, OutboundHTTPRequest request)
          If we have enough information to add an authentication header, then add it.
 void setCredentials(PasswordCredentials credentials)
          Users specify credentials as user names and passwords.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicAuthSession

public BasicAuthSession()
Method Detail

getCredentials

public PasswordCredentials getCredentials()
Specified by:
getCredentials in interface IAuthSession
Returns:
credentials associated with this auth session

setCredentials

public void setCredentials(PasswordCredentials credentials)
Description copied from interface: IAuthSession
Users specify credentials as user names and passwords. The AuthSession will convert them into the appropriate format for authenticating to the server.

Specified by:
setCredentials in interface IAuthSession
Parameters:
credentials -

parseAuthHeader

public AuthHeaderData parseAuthHeader(java.lang.String header)
Description copied from interface: IAuthSession
Given a WWW-Authenticate challenge header, parse it and return the results as an AuthHeaderData. This can be used to find the appropriate realm and look up credentials for use in authenticateRealm.

Specified by:
parseAuthHeader in interface IAuthSession
Parameters:
header -

authenticateRealm

public boolean authenticateRealm(XURL host,
                                 OutboundHTTPRequest request,
                                 AuthHeaderData data)
                          throws java.lang.SecurityException
Description copied from interface: IAuthSession
Given the data from a WWW-Authenticate challenge header, plus locally maintained state, calculate the appropriate response and add it to the outgoing request. The authenticator must update the copy of authData in authSession to match the options chosen from those presented in authData. Return true if the caller should retry the request if this request fails, false otherwise. (No point in retrying Basic, but Digest may return new information in the next 401)

Specified by:
authenticateRealm in interface IAuthSession
Parameters:
host -
request -
data -
Throws:
java.lang.SecurityException

preAuthenticate

public void preAuthenticate(XURL host,
                            OutboundHTTPRequest request)
Description copied from interface: IAuthSession
If we have enough information to add an authentication header, then add it. (Some schemes, like BASIC, allow speculative authentication before a 401 is received)

Specified by:
preAuthenticate in interface IAuthSession
Parameters:
host -
request -


copyright© 2001-2004 by webMethods All Rights Reserved.