My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

Gwt application securied by Spring Security,provided simple,gwt-sl and spring4gwt sample.

Maven User

Add repository and dependency to your pom.xml

   <dependencies>
       <dependency>
           <groupId>com.google.code.gwtsecurity</groupId>
           <artifactId>gwtsecurity</artifactId>
           <version>1.1.1</version>
       </dependency>
   </dependencies>

Basic Usage

add

   <inherits name="com.gwt.ss.GwtSecurity"/>

into your projct.gwt.xml,and method in RemoteService must throws GwtSecurityException to receive security notification

   public interface GreetingService extends RemoteService {

       String greetServer(String name) throws GwtSecurityException;

   }

config web.xml

  1. assign spring context location
  2.      <context-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext.xml</param-value>
        </context-param>
  3. add spring security filter
  4.      <filter>
            <filter-name>springSecurityFilterChain</filter-name>
            <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
        </filter>
        <filter-mapping>
            <filter-name>springSecurityFilterChain</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>
  5. add associate listeners
  6.      <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
        <listener>
            <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
        </listener>
  7. setup your servlet configuration

config spring seccurity context file

  1. include aop naming space
  2.      <beans:beans ...
             xmlns:aop="http://www.springframework.org/schema/aop"
             xsi:schemaLocation="...
               http://www.springframework.org/schema/aop 
               http://www.springframework.org/schema/aop/spring-aop.xsd"
  3. Enabling @AspectJ Support
  4.      <aop:aspectj-autoproxy/>
  5. create gwt spring security bean
  6.      <beans:bean class="com.gwt.ss.GwtExceptionTranslator"/>
  7. config other security setting

online demo

Simple Demo

GWT-SL Demo

Spring4Gwt Demo

Powered by Google Project Hosting