|
Gwt application securied by Spring Security,provided simple,gwt-sl and spring4gwt sample. Maven UserAdd 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 Usageadd <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- assign spring context location
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>- add spring security filter
<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>- add associate listeners
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>- setup your servlet configuration
config spring seccurity context file- include aop naming space
<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"- Enabling @AspectJ Support
<aop:aspectj-autoproxy/> - create gwt spring security bean
<beans:bean class="com.gwt.ss.GwtExceptionTranslator"/> - config other security setting
online demoSimple Demo GWT-SL Demo Spring4Gwt Demo
|