[opencms-dev] Set new Cookie with custom CmsAuthorizationHandler - Problem

Shi Jinghai shijh at langhua.org
Mon Apr 18 18:50:38 CEST 2011


Take a look at CmsLogin.java then.

On Mon, 2011-04-18 at 16:07 +0200, Thomas Wener wrote:
> Hello list,
> 
> I am trying to extend the CmsAuthorizationHandler in a way, that it sets
> automatically a cookie when a user logs in (e.g. is asked for
> user-credentials after trying to open a CmsResource which requires some
> user-permissions, in online mode).
> 
> To set a cookie I need a HttpServletResponse-Object and I tried to
> overwrite the function "requestAuthorization" to get this
> respone-object, so I can write a cookie.
> 
> My problem is, that this function is executed too early:
> 
> I want to set the cookie only AFTER successful login. But, after
> successfully logged in, I don't manage to get a
> HttpServletResponse-Objet, which is needed for setting the cookie.
> 
> 
> - I already tried to save that response in an attribute, without success.
> 
> - I also tried to get a HttpServletResponse-Object  (or/and
> CmsFlexResponse-Object) from the CmsFlexController, but this Controller
> always remains "null"
> 1. try: CmsFlexController flexController =
> CmsFlexController.getController(request);
> 
> 2. try: CmsFlexController controller = (CmsFlexController)
> request.getAttribute(CmsFlexController.ATTRIBUTE_NAME);
> -> flexController always remains null
> 
> Does the CmsFlexController need an initialization before?
> 
> 
> Does anybody have an idea how to resolve these problems?
> 
> 
> Thanks and greetings,
> Thomas Wener
> 
> 
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev





More information about the opencms-dev mailing list