クラス AbstractJaasAuthenticationProvider
- 実装されているすべてのインターフェース:
EventListenerSE、org.springframework.beans.factory.Aware、org.springframework.beans.factory.InitializingBean、org.springframework.context.ApplicationEventPublisherAware、org.springframework.context.ApplicationListener<SessionDestroyedEvent>、AuthenticationProvider
AuthenticationProvider 実装。 この AuthenticationProvider は、正しいユーザー名とパスワードを含む UsernamePasswordAuthenticationToken リクエストを検証できます。
この実装は、サブクラスの createLoginContext(CallbackHandler) の実装によって提供される JAAS 構成によってサポートされます。
認証ソースとして JAAS ログインモジュールを使用する場合は、時々 LoginContext は CallbackHandler 秒が必要になります。AbstractJaasAuthenticationProvider は内部 CallbackHandler を使用して、ApplicationContext で構成された JaasAuthenticationCallbackHandler をラップします。LoginContext が内部 CallbackHandler を呼び出すと、渡された各 Callback の各 JaasAuthenticationCallbackHandler に制御が渡されます。
JaasAuthenticationCallbackHandler は callbackHandlers プロパティを通じて AbstractJaasAuthenticationProvider に渡されます。
<property name="callbackHandlers">
<list>
<bean class="org.springframework.security.authentication.jaas.TestCallbackHandler"/>
<bean class="org.springframework.security.authentication.jaas.JaasNameCallbackHandler"/>
<bean class="org.springframework.security.authentication.jaas.JaasPasswordCallbackHandler"/>
</list>
</property>
LoginContext.login() を呼び出した後、AbstractJaasAuthenticationProvider はサブジェクト(LoginContext.getSubject()。getPrincipals)から返されたプリンシパルを取得します。返された各プリンシパルは、構成された AuthorityGranter に渡されます。AuthorityGranter は、返されたプリンシパルとロール名の間のマッピングです。AuthorityGranter が Authorization にロールを付与したい場合は、AuthorityGranter.grant(java.security.Principal) メソッドからそのロール名を返します。返されたロールは、GrantedAuthority として Authorization オブジェクトに適用されます。
AuthorityGranters は次のように Spring XML で構成されています...
<property name="authorityGranters">
<list>
<bean class="org.springframework.security.authentication.jaas.TestAuthorityGranter"/>
</list>
</property>
フィールドのサマリー
フィールドコンストラクターの概要
コンストラクター方法の概要
修飾子と型メソッド説明void必要なプロパティが設定されていることを検証します。authenticate(Authentication auth) 認証オブジェクトのプリンシパルとクレデンシャルを指定してユーザーにログインしようとしますprotected abstract LoginContextSEcreateLoginContext(CallbackHandlerSE handler) 認証に使用する LoginContext を作成します。protected org.springframework.context.ApplicationEventPublisherprotected void破棄されたセッションのセキュリティコンテキストを取得し、JaasAuthenticationTokenを含むすべてのセッションに対してLoginContext.logout()を呼び出すことにより、ログアウトを処理します。voidprotected voidJaasAuthenticationFailedEventを公開します。protected voidJaasAuthenticationSuccessEventを公開します。voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) voidsetAuthorityGranters(AuthorityGranter[] authorityGranters) 認証に付与されるロール名について調べられる AuthorityGranters を設定します。voidsetCallbackHandlers(JaasAuthenticationCallbackHandler[] callbackHandlers) LoginContext.login メソッドによって生成されたコールバックオブジェクトを処理するように JAASAuthenticationCallbackHandler 配列を設定します。voidsetLoginContextName(StringSE loginContextName) loginContextName を設定します。この名前は、loginConfig プロパティで指定された構成へのインデックスとして使用されます。voidsetLoginExceptionResolver(LoginExceptionResolver loginExceptionResolver) booleanこのAuthenticationProviderが指定されたAuthenticationオブジェクトをサポートする場合、trueを返します。クラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, toString, wait, waitSE, waitSEインターフェース org.springframework.context.ApplicationListener から継承されたメソッド
supportsAsyncExecution
フィールドの詳細
log
protected final org.apache.commons.logging.Log log
コンストラクターの詳細
AbstractJaasAuthenticationProvider
public AbstractJaasAuthenticationProvider()
メソッドの詳細
afterPropertiesSet
必要なプロパティが設定されていることを検証します。さらに、setCallbackHandlers(JaasAuthenticationCallbackHandler[])が有効なハンドラーで呼び出されていない場合は、JaasNameCallbackHandlerおよびJaasPasswordCallbackHandlerを使用するように初期化します。- 次で指定:
- インターフェース
org.springframework.beans.factory.InitializingBeanのafterPropertiesSet - 例外:
ExceptionSE
authenticate
認証オブジェクトのプリンシパルとクレデンシャルを指定してユーザーにログインしようとします- 次で指定:
- インターフェース
AuthenticationProviderのauthenticate - パラメーター:
auth- 認証される認証オブジェクト。- 戻り値:
- grantedAuthorities が設定された、認証された Authentication オブジェクト。
- 例外:
AuthenticationException- この実装は、「ロックされた」アカウントまたは 'disabled' アカウントを処理しません。このメソッドは、loginContext.login() メソッドが失敗した場合にスローされる LoginException のメッセージとともに、AuthenticationServiceException のみをスローします。
createLoginContext
protected abstract LoginContextSE createLoginContext(CallbackHandlerSE handler) throws LoginExceptionSE 認証に使用する LoginContext を作成します。- パラメーター:
handler- LoginContext に使用する必要がある CallbackHandler(非null)。- 戻り値:
- 認証に使用する LoginContext
- 例外:
LoginExceptionSE
handleLogout
破棄されたセッションのセキュリティコンテキストを取得し、JaasAuthenticationTokenを含むすべてのセッションに対してLoginContext.logout()を呼び出すことにより、ログアウトを処理します。- パラメーター:
event- 現在のセッションを含むセッションイベント
onApplicationEvent
- 次で指定:
- インターフェース
org.springframework.context.ApplicationListener<SessionDestroyedEvent>のonApplicationEvent
publishFailureEvent
protected void publishFailureEvent(UsernamePasswordAuthenticationToken token, AuthenticationException ase) JaasAuthenticationFailedEventを公開します。さまざまな機能のサブクラスによってオーバーライドできます- パラメーター:
token- 処理中の認証トークンase- 認証失敗の原因となった例外
publishSuccessEvent
JaasAuthenticationSuccessEventを公開します。さまざまな機能のサブクラスによってオーバーライドできます。- パラメーター:
token- 処理中のトークン
setAuthorityGranters
認証に付与されるロール名について調べられる AuthorityGranters を設定します。- パラメーター:
authorityGranters- AuthorityGranter 配列- 関連事項:
setCallbackHandlers
LoginContext.login メソッドによって生成されたコールバックオブジェクトを処理するように JAASAuthenticationCallbackHandler 配列を設定します。- パラメーター:
callbackHandlers- JAASAuthenticationCallbackHandlers の配列
setLoginContextName
loginContextName を設定します。この名前は、loginConfig プロパティで指定された構成へのインデックスとして使用されます。- パラメーター:
loginContextName-
setLoginExceptionResolver
supports
インターフェースからコピーされた説明:AuthenticationProviderこのAuthenticationProviderが指定されたAuthenticationオブジェクトをサポートする場合、trueを返します。trueを返しても、AuthenticationProviderが提示されたAuthenticationオブジェクトを認証できることは保証されません。これは単に、より詳細な評価をサポートできることを示しているだけです。AuthenticationProviderは、AuthenticationProvider.authenticate(Authentication)メソッドからnullを返して、別のAuthenticationProviderを試す必要があることを示すことができます。認証を実行できる
AuthenticationProviderの選択は、実行時にProviderManagerで行われます。- 次で指定:
- インターフェース
AuthenticationProviderのsupports - 戻り値:
- 実装が提示された
Authenticationクラスをより厳密に評価できる場合はtrue
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) - 次で指定:
- インターフェース
org.springframework.context.ApplicationEventPublisherAwareのsetApplicationEventPublisher
getApplicationEventPublisher
protected org.springframework.context.ApplicationEventPublisher getApplicationEventPublisher()