[cas-dev] JASIG CAS Client for Java 3.1.0-RC1 - how to access User ID

Alar ng at wbgrupp.net
Fri Jan 4 11:30:47 EST 2008


Thanks a lot for a tip - problem solved!

I think there should be 3 kind of additional tips in this Wiki page:

1. Minimum set of filters required - I was missing Validation filter
as a new user I didn't know CAS concept well enough and I just
expected that Authentication filter will do all the job.

2. Short description for filters and their purposes - good for newbies like me.

3. Filter and filter-mappings ORDER is important - yes now it makes
sense after messing around with debugger a bit.

Thanks again,
Alar



2008/1/4, Scott Battaglia <scott.battaglia at gmail.com>:
> Alar,
>
> Has the application already authenticated via CAS?  Also, is the filter
> coming after the authentication/validation filters?
>
> -Scott
>
>
> On Jan 4, 2008 9:50 AM, Alar < ng at wbgrupp.net> wrote:
> > Thanks for the fast reply.
> > I tried out these instructions, but I'm still in trouble. I just added
> > filter to web.xml in following way:
> >
> > ---
> >                <filter>
> >                        <filter-name>CAS HttpServletRequest Wrapper
> Filter</filter-name>
> >                        <filter-class>
> org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>
> >                </filter>
> >
> >                <filter-mapping>
> >                        <filter-name>CAS HttpServletRequest Wrapper
> Filter</filter-name>
> >                        <url-pattern>/*</url-pattern>
> >                </filter-mapping>
> >
> > ---
> >
> > I can see with debugger that this filter is accessed when I'm
> > redirected back from login screen  to my application, but in
> > HttpServletRequestWrapperFilter.java
> > at doFilter(..) the principal is null  as well as assertion is null
> > inside retrievePrincipalFromSessionOrRequest ()
> > And therefore getRemoteUser() returns also null later on.
> >
> > I also tried out AssertionThreadLocalFilter, but result is similar.
> >
> > Just for remark: I run this Tapestry 4 based application with Jetty
> > 5.x - but I hope this is not disturbing CAS.
> >
> > Thanks in advance,
> > Alar
> >
> >
> >
> >
> > 2008/1/4, Scott Battaglia <scott.battaglia at gmail.com>:
> >
> >
> >
> > > Alar,
> > >
> > > Yes, the JASIG CAS Client for Java 3.1 has a
> > > HttpServletRequestWrapperFilter:
> > >
> http://www.ja-sig.org/wiki/display/CASC/Configuring+the+JA-SIG+CAS+Client+for+Java+in+the+web.xml
> > >
> > > You can use that to access either the Principal object or the remote
> user.
> > > You can also use the AssertionThreadLocalFilter to make the Assertion
> > > available anywhere in your application.
> > >
> > > -Scott
> > >
> > >
> > >  On Jan 4, 2008 12:18 AM, Alar <ng at wbgrupp.net> wrote:
> > > >
> > > > I can not figure out how to access User ID from java code after
> > > > successful login.
> > > >
> > > > There is HttpServletRequestWrapperFilter example in
> > > >
> > > >
> > >
> http://www.ja-sig.org/products/cas/client/client-java/index.html
> > > >
> > > > but I'm not sure if is can be applied to client version 3.1
> > > >
> > > >
> > > > Thanks for tips!
> > > > _______________________________________________
> > > > cas-dev mailing list
> > > > cas-dev at tp.its.yale.edu
> > > > http://tp.its.yale.edu/mailman/listinfo/cas-dev
> > > >
> > >
> > >
> > >
> > > --
> > > -Scott Battaglia
> > >
> > > LinkedIn: http://www.linkedin.com/in/scottbattaglia
> > > _______________________________________________
> > > cas-dev mailing list
> > > cas-dev at tp.its.yale.edu
> > > http://tp.its.yale.edu/mailman/listinfo/cas-dev
> > >
> > >
> > _______________________________________________
> > cas-dev mailing list
> > cas-dev at tp.its.yale.edu
> > http://tp.its.yale.edu/mailman/listinfo/cas-dev
> >
>
>
>
> --
> -Scott Battaglia
>
> LinkedIn: http://www.linkedin.com/in/scottbattaglia
> _______________________________________________
> 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