Liang Yong Rui avatar Liang Yong Rui committed d614f3a

配置文件重构

Comments (0)

Files changed (4)

SpringSecurityTaobaoGrailsPlugin.groovy

             println """
 ERROR: Your configuration specifies
 
-   grails.plugins.springsecurity.taobao.userLookup.taobaoAccountsPropertyName='${taobaoAccountsPropertyName}'
+   grails.plugins.springsecurity.taobao.userLookup.accountsPropertyName='${taobaoAccountsPropertyName}'
 
 for $conf.userLookup.userDomainClassName but there's no property with that name in your user class;
 either add a hasMany for the OpenID strings:

grails-app/conf/Config.groovy

     warn   'org.mortbay.log'
 }
 
-grails.plugins.springsecurity.taobao.appSecret = '9f5361aaecfb2cbbf767e2cf9fb92af0'
 
 // Added by the Spring Security Core plugin:
 grails.plugins.springsecurity.userLookup.userDomainClassName = 'test.User'

grails-app/conf/DefaultTaobaoSecurityConfig.groovy

         appSecretMap = [:]
         accountDomainClassName = 'TaobaoAccount'
         active = true
-        //单位:秒
-        authRequestMaxSkewedTime = 1800
+        
         userLookup {
             accountsPropertyName = 'taobaoAccounts'
+        }
+        
+        accountLookup {
             nickPropertyName = 'nick'
             accountOwnerPropertyName = 'owner'
-        }   
+        }
     }
 }

src/groovy/com/mingidea/security/taobao/TaobaoAuthenticationUserDetailsService.groovy

         String taobaoNick = auth.principal
 
         TaobaoAccount.withTransaction { status ->
-            def nickPropertyName = conf.taobao.userLookup.nickPropertyName
+            def nickPropertyName = conf.taobao.accountLookup.nickPropertyName
             def taobaoAccount = TaobaoAccount.findWhere((nickPropertyName) : taobaoNick)
             def user
             if(taobaoAccount) {
-                def accountOwnerPropertyName = conf.taobao.userLookup.accountOwnerPropertyName
+                def accountOwnerPropertyName = conf.taobao.accountLookup.accountOwnerPropertyName
                 user = taobaoAccount."$accountOwnerPropertyName"
             } else {
                 if(localTaobaoAccountNotFoundHandler) {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.