org.opencms.security
Class CmsDefaultAuthorizationHandler

java.lang.Object
  extended by org.opencms.main.A_CmsAuthorizationHandler
      extended by org.opencms.security.CmsDefaultAuthorizationHandler
All Implemented Interfaces:
I_CmsAuthorizationHandler

public class CmsDefaultAuthorizationHandler
extends A_CmsAuthorizationHandler

Defines default authorization methods.

Since:
6.5.4
Version:
$Revision: 1.2 $
Author:
Michael Moossen

Field Summary
static java.lang.String AUTHORIZATION_BASIC_PREFIX
          Basic authorization prefix constant.
static java.lang.String HEADER_AUTHORIZATION
          Authorization header constant.
static java.lang.String SEPARATOR_CREDENTIALS
          Credentials separator constant.
 
Constructor Summary
CmsDefaultAuthorizationHandler()
           
 
Method Summary
protected  CmsObject checkBasicAuthorization(javax.servlet.http.HttpServletRequest req)
          Checks if the current request contains http basic authentication information in the headers, if so the user is tried to log in with this data, and on success a session is generated.
 CmsObject initCmsObject(javax.servlet.http.HttpServletRequest request)
          Creates a new cms object from the given request object.
 CmsObject initCmsObject(javax.servlet.http.HttpServletRequest request, java.lang.String userName, java.lang.String pwd)
          Autheticates the current request with additional user information.
 
Methods inherited from class org.opencms.main.A_CmsAuthorizationHandler
initCmsObjectFromSession, registerSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTHORIZATION_BASIC_PREFIX

public static final java.lang.String AUTHORIZATION_BASIC_PREFIX
Basic authorization prefix constant.

See Also:
Constant Field Values

HEADER_AUTHORIZATION

public static final java.lang.String HEADER_AUTHORIZATION
Authorization header constant.

See Also:
Constant Field Values

SEPARATOR_CREDENTIALS

public static final java.lang.String SEPARATOR_CREDENTIALS
Credentials separator constant.

See Also:
Constant Field Values
Constructor Detail

CmsDefaultAuthorizationHandler

public CmsDefaultAuthorizationHandler()
Method Detail

initCmsObject

public CmsObject initCmsObject(javax.servlet.http.HttpServletRequest request)
Description copied from interface: I_CmsAuthorizationHandler
Creates a new cms object from the given request object.

This method is called by OpenCms everytime a resource is requested and the session can not automatically be authenticated.

Parameters:
request - the http request to authenticate
Returns:
the cms context object associated to the current session
See Also:
I_CmsAuthorizationHandler.initCmsObject(HttpServletRequest)

initCmsObject

public CmsObject initCmsObject(javax.servlet.http.HttpServletRequest request,
                               java.lang.String userName,
                               java.lang.String pwd)
                        throws CmsException
Description copied from interface: I_CmsAuthorizationHandler
Autheticates the current request with additional user information.

You have to call this method by your own.

Parameters:
request - the http request to authenticate
userName - the user name to authenticate
pwd - the user password to authenticate with
Returns:
the cms context object associated to the given user
Throws:
CmsException - if something goes wrong
See Also:
I_CmsAuthorizationHandler.initCmsObject(HttpServletRequest, String, String)

checkBasicAuthorization

protected CmsObject checkBasicAuthorization(javax.servlet.http.HttpServletRequest req)
Checks if the current request contains http basic authentication information in the headers, if so the user is tried to log in with this data, and on success a session is generated.

Parameters:
req - the current http request
Returns:
the authenticated cms object, or null if failed