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

Thomas Wener thomas.wener at componio.net
Mon Apr 18 16:07:08 CEST 2011


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




More information about the opencms-dev mailing list