クラス 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 LoginContextSE
createLoginContext
(CallbackHandlerSE handler) 認証に使用する LoginContext を作成します。protected org.springframework.context.ApplicationEventPublisher
protected void
破棄されたセッションのセキュリティコンテキストを取得し、JaasAuthenticationToken
を含むすべてのセッションに対してLoginContext.logout()
を呼び出すことにより、ログアウトを処理します。void
protected void
JaasAuthenticationFailedEvent
を公開します。protected void
JaasAuthenticationSuccessEvent
を公開します。void
setApplicationEventPublisher
(org.springframework.context.ApplicationEventPublisher applicationEventPublisher) void
setAuthorityGranters
(AuthorityGranter[] authorityGranters) 認証に付与されるロール名について調べられる AuthorityGranters を設定します。void
setCallbackHandlers
(JaasAuthenticationCallbackHandler[] callbackHandlers) LoginContext.login メソッドによって生成されたコールバックオブジェクトを処理するように JAASAuthenticationCallbackHandler 配列を設定します。void
setLoginContextName
(StringSE loginContextName) loginContextName を設定します。この名前は、loginConfig プロパティで指定された構成のインデックスとして使用されます。void
setLoginExceptionResolver
(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 が設定されています。
- 例外:
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()