2016-04-28 58 views
0

我們正在從JBoss的4.2.1移植我們的代碼和Spring 3.2.9安全到JBoss Wildfly 10.0.0和春季安全4.0.4春季安全JaasAuthenticationProvider沒有看到Wildfly 10的SecurityDomain

我具有下面的問題將我的Spring Security JaasAuthenticationProvider與standalone.xml中定義的JBoss Wildfly 10安全域進行了集成:它不會執行在我的安全域中定義的LoginModules,實際上它似乎只是在wildfly 10.0的auth.conf中定義的ClientLoginModule。 0 picketbox-4.9.4.jar(默認)。

我的安全域的配置如下:

  <security-domain name="mysecdomain" cache-type="default"> 
       <authentication> 
        <login-module code="LdapExtended" flag="sufficient"> 
         <module-options.../> 
        </login-module> 
       </authentication> 
      </security-domain> 

和我的部署應用程序的我的應用程序上下文JaasAuthenticationProvider:

<bean id="jaasAuthenticationProvider" class=org.springframework.security.authentication.jaas.JaasAuthenticationProvider"> 
    <property name="loginConfig" value="WEB-INF/login.conf" /> 
    <property name="loginContextName" value="mysecdomain"/> 
    <property name="callbackHandlers"> 
     <list> 
      <bean class="org.springframework.security.authentication.jaas.JaasNameCallbackHandler" /> 
      <bean class="org.springframework.security.authentication.jaas.JaasPasswordCallbackHandler" /> 
     </list> 
    </property> 
    <property name="authorityGranters"> 
     <list> 
      <bean class="com.my.MyAuthorityGranter" /> 
     </list> 
    </property> 
</bean> 

但是,當我執行定義jaasAuthenticationProvider,它輸出以下,以Wildfly的server.log:

2016-04-27 03:37:18,367 TRACE [org.jboss.security] (default task-4) PBOX00221: Begin getAppConfigurationEntry(mysecdomain), size: 1 
2016-04-27 03:37:18,368 TRACE [org.jboss.security] (default task-4) PBOX00222: getAppConfigurationEntry(mysecdomain), no entry found, trying parent config null 
2016-04-27 03:37:18,368 TRACE [org.jboss.security] (default task-4) PBOX00223: getAppConfigurationEntry(mysecdomain), no entry in parent config, trying default other 
2016-04-27 03:37:18,368 TRACE [org.jboss.security] (default task-4) PBOX00224: End getAppConfigurationEntry(mysecdomain), AuthInfo: AppConfigurationEntry[]: 
[0] 
LoginModule Class: org.jboss.security.ClientLoginModule 
ControlFlag: LoginModuleControlFlag: required 
Options: 

2016-04-27 03:37:18,374 DEBUG [org.jboss.security] (default task-4) PBOX00350: Module option: jboss.security.security_domain, value: other 
2016-04-27 03:37:18,374 DEBUG [org.jboss.security] (default task-4) PBOX00350: Module option: restore-login-identity, value: null 
2016-04-27 03:37:18,374 DEBUG [org.jboss.security] (default task-4) PBOX00350: Module option: password-stacking, value: null 
2016-04-27 03:37:18,376 TRACE [org.jboss.security] (default task-4) PBOX00240: Begin login method 
2016-04-27 03:37:18,387 TRACE [org.jboss.security] (default task-4) PBOX00351: Obtained auth info from handler, principal: xxxxx, credential class: class [C 
2016-04-27 03:37:18,388 TRACE [org.jboss.security] (default task-4) PBOX00241: End login method, isValid: true 
2016-04-27 03:37:18,388 TRACE [org.jboss.security] (default task-4) PBOX00242: Begin commit method, overall result: true 

所以顯然,我做錯了什麼,但無法弄清楚什麼?上面在JBoss 4.2.1和在login-config.xml中定義的應用程序策略很好地工作,但不再是

回答

0

找到了解決方案:在新的Spring Security(4.0.4版本在這裏)需要添加以下屬性JaasConfigurationProvider,否則它會刪除已上傳的配置(安全域),並與picketbox默認配置替換它們:

<property name="refreshConfigurationOnStartup" value="false"/> 

現在它就像魅力和供應商可以看到所有定義的安全域