Tuesday, June 21, 2005

Using CAS filter with JSTL

Central Authentication Service (CAS) is enterprise Single Sign On for the web. Formerly a Yale University project, it is now part of the JASIG community.

I recently submitted the following snippet to the CAS users mailing list. It has also been reproduced on the CAS wiki.

If you are using JSTL with the CAS filter and need to get hold of the user's name through thesession attribute "edu.yale.its.tp.cas.client.filter.user". Then thisis how to do it:

<c:out value="${sessionScope['edu.yale.its.tp.cas.client.filter.user']}"/>

You need to use the above method because the usual way to accesssession scope variables won't work because JSTL uses the dot as anidentifier, therefore:

<c:out value="${sessionScope.edu.yale.its.tp.cas.client.filter.user}"/>

wouldn't work.