[cas-dev] Adding of Cookie after Authentication

Teemu Hämäläinen teemu.hamalainen at cidercone.com
Thu May 18 09:21:27 EDT 2006


I have following code in my additional action:
-----------%<----------------
   protected Event doExecuteInternal(final RequestContext context,
                                      final String
ticketGrantingTicketId,
                                      final String service,
                                      final boolean gateway,
                                      final boolean renew,
                                      final boolean warn) {

        final HttpServletRequest request =
            ContextUtils.getHttpServletRequest(context);

        final HttpServletResponse response =
            ContextUtils.getHttpServletResponse(context);

        String userName = (String) request.getAttribute("username");
        if (userName != null) {
-----------%<----------------
And question is how I can get the username? In the code above userName
is set to null.

If I add hardcoded Cookie to the response it goes to the browser as
supposed. So the cookie adding works fine.

My own action is located between 
<action-state id="sendTicketGrantingTicket"> 
and 
<action-state id="serviceCheck">
states.

- Teemu -


On Thu, 2006-05-18 at 08:05 -0400, Scott Battaglia wrote:
> Teemu,
> 
> You merely need to add an additional Action to your login webflow.  You 
> would want to do this before you do the redirect.
> 
> http://developer.ja-sig.org/source/viewrep/jasig/cas3/webapp/WEB-INF/login-webflow.xml?r=1.6 
> is what the current (CAS 3.0.5-SNAPSHOT) web flow looks like. 3.0.4's 
> looks slightly different.
> 
> -Scott
> 
> 
> 
> Teemu Hämäläinen wrote:
> 
> >Hello,
> >
> >I am using CAS 3.0.4 and I have one special need for CAS. When user is
> >authenticated throught CAS login page, one cookie need to be added and
> >that cookie would contain username information.
> >
> >I have tryed to find correct place from the code where I would have
> >HttpServletResponce and username available and then I could set the
> >correct cookie. Anyway... I have not managed on this task. Any
> >suggestions?
> >
> >Regards
> >
> >    Teemu
> >
> >_______________________________________________
> >cas-dev mailing list
> >cas-dev at tp.its.yale.edu
> >http://tp.its.yale.edu/mailman/listinfo/cas-dev
> >  
> >



More information about the cas-dev mailing list