Some javascript/style in this post has been disabled (
why?)
Hi,
Currently if we need to get Assertion object from Http request,
there are two ways
1. Configure AssertionThreadLocalFilter, and use AssertionHolder
to get assertion object.
2. If we are interested in just user principal, we can
configure HttpServletRequestWrapperFilter to wrap servlet request and
use getPrincipal method.
3. Call
request.getSession(false).getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION)
The first two techniques have a drawback that they depend on
order in which filters are defined in web.xml.
I think providing a simple utility like AssertionUtils, which
can give assertion object from servlet request can be useful.
Clients can use it as
AssertionUtils.getAssertion(servletRequest), and do not need to
configure any filter. It can be used in Jasig client code whenever we
need to fetch assertion object from request/session.
Thanks,
Unmesh
public class AssertionUtils {
public static Assertion getAssertion(ServletRequest
servletRequest) {
final HttpServletRequest request = (HttpServletRequest)
servletRequest;
final HttpSession session = request.getSession(false);
final Assertion assertion = (Assertion) (session == null ?
request.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION) :
session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION));
return assertion;
}
}
Windows 7: Find the right PC for you.
Learn more.
--
You are currently subscribed to [hidden email] as: [hidden email]
To unsubscribe, change settings or access archives, see http://www.ja-sig.org/wiki/display/JSG/cas-user