クラス DefaultJaasAuthenticationProvider

  • 実装されたすべてのインターフェース:
    java.util.EventListenerorg.springframework.beans.factory.Awareorg.springframework.beans.factory.InitializingBeanorg.springframework.context.ApplicationEventPublisherAwareorg.springframework.context.ApplicationListener<SessionDestroyedEvent>AuthenticationProvider

    public class DefaultJaasAuthenticationProvider
    extends AbstractJaasAuthenticationProvider

    提供された構成を使用して LoginContext を作成します。これにより、Configuration.getConfiguration() の値に関係なく構成を挿入できます。

    特定の構成実装にバインドされていませんが、JAAS 構成のメモリ内バージョンは InMemoryConfiguration を使用して表すことができます。

    次の JAAS 構成:

     SPRINGSECURITY {
        sample.SampleLoginModule required;
      };
     

    次のように表すことができます。

     <bean id="jaasAuthProvider" class="org.springframework.security.authentication.jaas.DefaultJaasAuthenticationProvider">
       <property name="configuration">
         <bean class="org.springframework.security.authentication.jaas.memory.InMemoryConfiguration">
           <constructor-arg>
             <map>
               <!-- SPRINGSECURITY is the default loginContextName for AbstractJaasAuthenticationProvider-->
               <entry key="SPRINGSECURITY">
                 <array>
                   <bean class="javax.security.auth.login.AppConfigurationEntry">
                     <constructor-arg value="sample.SampleLoginModule" />
                     <constructor-arg>
                       <util:constant static-field="javax.security.auth.login.AppConfigurationEntry$LoginModuleControlFlag.REQUIRED" />
                     </constructor-arg>
                     <constructor-arg>
                       <map></map>
                     </constructor-arg>
                   </bean>
                 </array>
               </entry>
             </map>
           </constructor-arg>
         </bean>
       </property>
       <property name="authorityGranters">
         <list>
           <!-- You will need to write your own implementation of AuthorityGranter -->
           <bean class="org.springframework.security.authentication.jaas.TestAuthorityGranter"/>
         </list>
       </property>
     </bean>
     
    関連事項:
    AbstractJaasAuthenticationProvider, InMemoryConfiguration
    • コンストラクターの詳細

      • DefaultJaasAuthenticationProvider

        public DefaultJaasAuthenticationProvider()
    • メソッドの詳細

      • createLoginContext

        protected javax.security.auth.login.LoginContext createLoginContext​(javax.security.auth.callback.CallbackHandler handler)
                                                                     throws javax.security.auth.login.LoginException
        setConfiguration(Configuration) で指定された構成を使用して LoginContext を作成します。
        次で指定:
        クラス AbstractJaasAuthenticationProvidercreateLoginContext 
        パラメーター:
        handler - LoginContext に使用する必要がある CallbackHandler(非 null)。
        戻り値:
        認証に使用する LoginContext
        例外:
        javax.security.auth.login.LoginException
      • getConfiguration

        protected javax.security.auth.login.Configuration getConfiguration()
      • setConfiguration

        public void setConfiguration​(javax.security.auth.login.Configuration configuration)
        認証に使用する構成を設定します。
        パラメーター:
        configuration - createLoginContext(CallbackHandler) が呼び出されたときに使用される構成。