This evolution of the CAS Java client came into being as a client for use in the YaleInfo Portal for Fall 2004. The YaleCasContext security context could not accomodate a dynamic parameter on the Login URL (providing the uP_fname of a channel to be displayed in focus mode immediately after login) and so did not meet immediate requirements. There are a number of ways to solve this problem; the way we ran with was using a CAS client filter to do the actual ticket validation and a YaleCasFilteredContext, to replace the YaleCasContext security context, as a consumer of the results of authentication, which are exposed by StaticCasReceiptCacherFilter as a CASReceipt.
Here is provided some example source code which uses this CASClient to accomplish these goals.
A PortalException which Proxy ticket acquiring code will throw on failure. This exception uses Yale-local ErrorID Portal error handling, but should be adaptable for use elsewhere.
This version of the CasConnectionContext looks for implementations of the IYaleCasContext interface rather than the YaleCasContext class itself. This allows it to use the YaleCasFilteredContext for proxy ticket acquisition.
An interface for security context implementations which have proxy ticket acquisition capabilities. The CasConnectionContext now looks for instances of this interface, rather than only for YaleCasContext instances.
Traditional YaleCasContext, modified to fit the new interface.
Traditional factory for the YaleCasContext.
Akin to the YaleCasContext. Instead of performing ticket validation itself, this context uses the ticket to query the StaticReceiptCacherFilter for a CASReceipt encapsulating the result of prior ticket validation. This receipt includes the pgtIou, and thereby allows this context to obtain proxy tickets.
Factory for the YaleCasFilteredContext. You declare this factory in your security.properties file to use this context.
This web.xml fragment outlines how one might configure appropriate filter mappings so that the YaleCasFilteredContext can succeed.
A sample security properties fragment which shows how you might configure uPortal to use the YaleCasFilteredContextFactory.