Commits

明点软件 committed 085ab05

增加expireSession() 方法

Comments (0)

Files changed (3)

SpringSecurityTaobaoGrailsPlugin.groovy

 
         SpringSecurityUtils.registerProvider 'taobaoAuthenticationProvider'
         SpringSecurityUtils.registerFilter 'taobaoAuthenticationFilter', SecurityFilterPosition.OPENID_FILTER
-        SpringSecurityUtils.registerFilter 'concurrencySessionFilter', SecurityFilterPosition.CONCURRENT_SESSION_FILTER
+        SpringSecurityUtils.registerFilter 'concurrentSessionFilter', SecurityFilterPosition.CONCURRENT_SESSION_FILTER
 
         taobaoAuthenticationProvider(TaobaoAuthenticationProvider) {
             appSecretMap = conf.taobao.appSecretMap
             maximumSessions = conf.maxConcurrentSessions //default is -1 for unlimited sessions
         }
         
-        concurrencySessionFilter(ConcurrentSessionFilter) {
+        concurrentSessionFilter(ConcurrentSessionFilter) {
             sessionRegistry = ref('sessionRegistry')
+            expiredUrl = conf.expiredUrl
         }
         
         sessionRegistry(SessionRegistryImpl)

grails-app/conf/Config.groovy

     warn   'org.mortbay.log'
 }
 
+grails.plugins.springsecurity.expiredUrl = '/expired'
 
 // Added by the Spring Security Core plugin:
 grails.plugins.springsecurity.useHttpSessionEventPublisher = true 

grails-app/controllers/test/TestController.groovy

 import com.mingidea.security.taobao.util.ExSpringSecurityUtils
 
 class TestController {
-    def springSecurityService 
+    def springSecurityService 
+    def concurrentSessionFilter
     def index = { 
         def user = springSecurityService.currentUser
         render 'user id: ' + user.id
     def expire = {
         def userId = 1
         render ExSpringSecurityUtils.expireSession(userId)
+    }
+    
+    def p = {
+        println concurrentSessionFilter
     }
 }