Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
89 lines (79 sloc) 3.07 KB

Usage

Server

Add the CAS filters in you web.xml except the AuthenticationFilter.

<filter>
  <filter-name>CAS Validation Filter</filter-name>
  <filter-class>org.jasig.cas.client.validation.Cas10TicketValidationFilter</filter-class>
  <init-param>
    <param-name>casServerUrlPrefix</param-name>
    <param-value>https://cas.company.com</param-value>
  </init-param>
  <init-param>
    <param-name>serverName</param-name>
    <param-value>http://www.company.com</param-value>
  </init-param>
</filter>
<filter>
  <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
  <filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>
</filter>
<filter>
  <filter-name>CAS Assertion Thread Local Filter</filter-name>
  <filter-class>org.jasig.cas.client.util.AssertionThreadLocalFilter</filter-class>
</filter>
<filter>
  <filter-name>GWT RequestFactory CAS Auth Filter</filter-name>
  <filter-class>fr.univpau.gwt.cas.server.CasFilter</filter-class>
  <init-param>
    <param-name>serverName</param-name>
    <param-value>https://www.company.com/MyGwtApp/MyGwtApp.html</param-value>
  </init-param>
  <init-param>
    <param-name>casServerLoginUrl</param-name>
    <param-value>https://cas.company.com/login</param-value>
  </init-param>
</filter>

<filter-mapping>
   <filter-name>CAS Validation Filter</filter-name>
   <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>CAS Assertion Thread Local Filter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
    <filter-name>GWT RequestFactory CAS Auth Filter</filter-name>
    <url-pattern>/gwtRequest</url-pattern>
</filter-mapping>

Client

Add <inherits name="fr.univpau.gwt.cas.Cas"/> to your GWT XML module descriptor. Extends your own RequestFactory interface with MakeCasRequest :

public interface MyRequestFactory extends RequestFactory, MakeCasRequest {
}

Use CasRequestTransport as RequestTransport when you initialize your RF instance :

MyRequestFactory rf = GWT.create(MyRequestFactory.class);
rf.initialize(bus, new CasRequestTransport());

Then you can use it as a new RequestFactory request :

CasRequest request = rf.casRequest();
request.getCurrentUser().to(new Receiver() {
    @Override
    public void onSuccess(CasUserProxy user) {
        Window.alert("user is " + user.getLogin());
    }
}).
request.fire();

You can also use the simple but embedded widget LoginWidget

Maven repositories

Latest release (for GWT 2.4):