com.sapportals.wcm.util.http

Interface IContext


public interface IContext

Interface for user and authentication information objects in http requests. A IWDContext represents a user on which behalf connections are made. When authorization is necessary, the context is asked to calculate the credentials which shall be sent to the http server.

Copyright (c) SAP AG 2001-2002


Method Summary
 boolean appliesCredentials()
          Answer if authorization credentials are used in this context.
 boolean applyCredentials(IRequester requester, String uri, IRequest request)
          Apply the credentials for a HTTP request.
 boolean canTriggerAuthentication(IRequester requester)
          Return if authentication responses (HTTP 401) can be triggered in this context.
 void endUse(IRequester requester)
          This context will no longer be used for the given requester
 String getCookieHeaderValue(HttpUrl requestUri)
          Return string in HTTP header value format for cookies in this context.
 Map getCookies()
           
 UserInfo getProxyUserInfo()
          Return user info for proxy server
 ICredentials getSpecialCredentials()
          Return any installed special credentials or null if none is installed
 UserInfo getUserInfo()
          Return user info for this context.
 boolean isNew()
           
 void openedConnection(IRequester requester)
          New connection in requester was opened for this context.
 void responseCredentials(IRequester requester, IResponse response)
          Give the context the possiblity to process authenticate information in the response message, like Authenticate-Info.
 void setCookie(ICookie cookie)
          Sets a new cookie in this context
 void setProxyUserInfo(UserInfo ui)
          Sets username/password to be used in this context for proxy.
 void setSpecialCredentials(ICredentials handler)
          Set a special credentials handler which is run before any of the known authentication schemes (basic, digest) are run.
 boolean setupCredentials(IRequester requester, Headers header)
          Set the credentials for this context depending on the header information (received from a 401 response).
 boolean setupProxyCredentials(IRequester requester, Headers header)
          Set the credentials for this context depending on the header information (received from a 407 response).
 void setUserInfo(UserInfo ui)
          Sets username/password to be used in this context.
 void startUse(IRequester requester)
          This context will be used for the given requester
 

Method Detail

getUserInfo

UserInfo getUserInfo()
Return user info for this context.

Returns:
userinfo for this context.

getProxyUserInfo

UserInfo getProxyUserInfo()
Return user info for proxy server

Returns:
userinfo for proxy server

getCookies

Map getCookies()
Returns:
the map of valid cookies

getCookieHeaderValue

String getCookieHeaderValue(HttpUrl requestUri)
Return string in HTTP header value format for cookies in this context. When no cookies are present, the method returns null .

Parameters:
requestUri - TBD: Description of the incoming method parameter
Returns:
cookies in HTTP header value format or null

isNew

boolean isNew()

setCookie

void setCookie(ICookie cookie)
Sets a new cookie in this context

Parameters:
cookie -

setUserInfo

void setUserInfo(UserInfo ui)
Sets username/password to be used in this context.

Parameters:
ui - userInfo to be set

setProxyUserInfo

void setProxyUserInfo(UserInfo ui)
Sets username/password to be used in this context for proxy.

Parameters:
ui - proxyUserInfo to be set

appliesCredentials

boolean appliesCredentials()
Answer if authorization credentials are used in this context.

Returns:
if authorization credentials are used in this context

applyCredentials

boolean applyCredentials(IRequester requester,
                         String uri,
                         IRequest request)
                         throws WcmException
Apply the credentials for a HTTP request. The type of credentials depends on the last call to setupCredentials . The credentials are applied to the request header fields.

Parameters:
uri - the requested uri
request - the request to calculate the credentials for
requester - TBD: Description of the incoming method parameter
Returns:
if credentials have been added to the header fields
Throws:
WcmException - Exception raised in failure situation

setupCredentials

boolean setupCredentials(IRequester requester,
                         Headers header)
                         throws WcmException
Set the credentials for this context depending on the header information (received from a 401 response). The header is assumed to containt one ore more WWW-Authenticate headers, which indicate the authorization schemes the server understands.

Parameters:
requester - TBD: Description of the incoming method parameter
header - TBD: Description of the incoming method parameter
Returns:
if successful
Throws:
WcmException - Exception raised in failure situation

setupProxyCredentials

boolean setupProxyCredentials(IRequester requester,
                              Headers header)
                              throws WcmException
Set the credentials for this context depending on the header information (received from a 407 response). The header is assumed to containt one ore more Proxy-Authenticate headers, which indicate the authorization schemes the server understands.

Parameters:
requester - TBD: Description of the incoming method parameter
header - TBD: Description of the incoming method parameter
Returns:
if successful
Throws:
WcmException - Exception raised in failure situation

responseCredentials

void responseCredentials(IRequester requester,
                         IResponse response)
                         throws WcmException
Give the context the possiblity to process authenticate information in the response message, like Authenticate-Info.

Parameters:
requester - TBD: Description of the incoming method parameter
response - TBD: Description of the incoming method parameter
Throws:
WcmException - Exception raised in failure situation

setSpecialCredentials

void setSpecialCredentials(ICredentials handler)
Set a special credentials handler which is run before any of the known authentication schemes (basic, digest) are run.

Parameters:
handler - to installed (or null to remove)

getSpecialCredentials

ICredentials getSpecialCredentials()
Return any installed special credentials or null if none is installed

Returns:
installed special credentials handler

openedConnection

void openedConnection(IRequester requester)
New connection in requester was opened for this context.

Parameters:
requester - which opened new connection

startUse

void startUse(IRequester requester)
This context will be used for the given requester

Parameters:
requester -

endUse

void endUse(IRequester requester)
This context will no longer be used for the given requester

Parameters:
requester -

canTriggerAuthentication

boolean canTriggerAuthentication(IRequester requester)
Return if authentication responses (HTTP 401) can be triggered in this context.

Parameters:
requester - to work in
Returns:
TBD: Description of the outgoing return value
Access Rights

This class can be accessed from:


SC DC Public Part ACH
[sap.com] KMC-CM [sap.com] tc/km/frwk api EP-KM-CM
[sap.com] KMC-WPC [sap.com] tc/kmc/wpc/wpcfacade api EP-PIN-WPC-WCM


Copyright 2014 SAP AG Complete Copyright Notice