クラス AbstractLdapAuthenticationProvider
- java.lang.Object
-
- org.springframework.security.ldap.authentication.AbstractLdapAuthenticationProvider
- 実装されているすべてのインターフェース:
org.springframework.beans.factory.Aware、org.springframework.context.MessageSourceAware、AuthenticationProvider
public abstract class AbstractLdapAuthenticationProvider extends java.lang.Object implements AuthenticationProvider, org.springframework.context.MessageSourceAware
標準LdapAuthenticationProviderおよびActiveDirectoryLdapAuthenticationProviderの基本クラス。- 導入:
- 3.1
フィールドのサマリー
フィールド 修飾子と型 フィールド 説明 protected org.apache.commons.logging.Logloggerprotected org.springframework.context.support.MessageSourceAccessormessagesprotected UserDetailsContextMapperuserDetailsContextMapper
コンストラクターの概要
コンストラクター コンストラクター 説明 AbstractLdapAuthenticationProvider()
メソッドのサマリー
すべてのメソッド インスタンスメソッド 抽象メソッド 具象メソッド 修飾子と型 メソッド 説明 Authenticationauthenticate(Authentication authentication)AuthenticationManager.authenticate(Authentication)と同じ契約で認証を実行します。protected AuthenticationcreateSuccessfulAuthentication(UsernamePasswordAuthenticationToken authentication, UserDetails user)authenticateメソッドから返される最終的なAuthenticationオブジェクトを作成します。protected abstract org.springframework.ldap.core.DirContextOperationsdoAuthentication(UsernamePasswordAuthenticationToken auth)protected UserDetailsContextMappergetUserDetailsContextMapper()サブクラスで使用するために注入されたUserDetailsContextMapper戦略へのアクセスを提供します。protected abstract java.util.Collection<? extends GrantedAuthority>loadUserAuthorities(org.springframework.ldap.core.DirContextOperations userData, java.lang.String username, java.lang.String password)voidsetAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper)ストレージからロードされた権限を、UsernamePasswordAuthenticationTokenに関連付けられる新しい権限のセットに変換するために使用されるGrantedAuthoritiesMapperを設定します。voidsetMessageSource(org.springframework.context.MessageSource messageSource)voidsetUseAuthenticationRequestCredentials(boolean useAuthenticationRequestCredentials)提供されたパスワードを、成功した認証トークンの資格情報として使用するかどうかを決定します。voidsetUserDetailsContextMapper(UserDetailsContextMapper userDetailsContextMapper)createSuccessfulAuthentication(org.springframework.security.authentication.UsernamePasswordAuthenticationToken, org.springframework.security.core.userdetails.UserDetails)メソッドによって返される Authentication のプリンシパルとして格納される UserDetails の作成にカスタム戦略を使用できるようにします。booleansupports(java.lang.Class<?> authentication)このAuthenticationProviderが指定されたAuthenticationオブジェクトをサポートする場合、trueを返します。
フィールドの詳細
logger
protected final org.apache.commons.logging.Log logger
messages
protected org.springframework.context.support.MessageSourceAccessor messages
userDetailsContextMapper
protected UserDetailsContextMapper userDetailsContextMapper
メソッドの詳細
authenticate
public Authentication authenticate(Authentication authentication) throws AuthenticationException
インターフェースからコピーされた説明:AuthenticationProviderAuthenticationManager.authenticate(Authentication)と同じ契約で認証を実行します。- 次で指定:
- インターフェース
AuthenticationProviderのauthenticate - パラメーター:
authentication- 認証リクエストオブジェクト。- 戻り値:
- 資格情報を含む完全に認証されたオブジェクト。
AuthenticationProviderが、渡されたAuthenticationオブジェクトの認証をサポートできない場合、nullを返すことがあります。そのような場合、提示されたAuthenticationクラスをサポートする次のAuthenticationProviderが試行されます。 - 例外:
AuthenticationException- 認証が失敗した場合。
doAuthentication
protected abstract org.springframework.ldap.core.DirContextOperations doAuthentication(UsernamePasswordAuthenticationToken auth)
loadUserAuthorities
protected abstract java.util.Collection<? extends GrantedAuthority> loadUserAuthorities(org.springframework.ldap.core.DirContextOperations userData, java.lang.String username, java.lang.String password)
createSuccessfulAuthentication
protected Authentication createSuccessfulAuthentication(UsernamePasswordAuthenticationToken authentication, UserDetails user)
authenticateメソッドから返される最終的なAuthenticationオブジェクトを作成します。- パラメーター:
authentication- 元の認証リクエストトークンuser- 構成された UserDetailsContextMapper によって返される UserDetails インスタンス。- 戻り値:
- 完全に認証されたユーザーの認証オブジェクト。
supports
public boolean supports(java.lang.Class<?> authentication)
インターフェースからコピーされた説明:AuthenticationProviderこのAuthenticationProviderが指定されたAuthenticationオブジェクトをサポートする場合、trueを返します。trueを返すことは、AuthenticationProviderがAuthenticationクラスの提示されたインスタンスを認証できることを保証しません。それは、それがより詳細な評価をサポートできることを示しています。AuthenticationProviderは、AuthenticationProvider.authenticate(Authentication)メソッドからnullを返して、別のAuthenticationProviderを試す必要があることを示すことができます。認証を実行できる
AuthenticationProviderの選択は、実行時にProviderManagerで行われます。- 次で指定:
- インターフェース
AuthenticationProviderのsupports - 戻り値:
- 実装が提示された
Authenticationクラスをより厳密に評価できる場合はtrue
setUseAuthenticationRequestCredentials
public void setUseAuthenticationRequestCredentials(boolean useAuthenticationRequestCredentials)
提供されたパスワードを、成功した認証トークンの資格情報として使用するかどうかを決定します。false に設定した場合、パスワードは、構成されたUserDetailsContextMapperによって作成された UserDetails オブジェクトから取得されます。多くの場合、ディレクトリからパスワードを読み取ることができないため、デフォルトは true です。- パラメーター:
useAuthenticationRequestCredentials-
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource)
- 次で指定:
- インターフェース
org.springframework.context.MessageSourceAwareのsetMessageSource
setAuthoritiesMapper
public void setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper)
ストレージからロードされた権限を、UsernamePasswordAuthenticationTokenに関連付けられる新しい権限のセットに変換するために使用されるGrantedAuthoritiesMapperを設定します。設定されていない場合、デフォルトでNullAuthoritiesMapperになります。- パラメーター:
authoritiesMapper- ユーザーの権限のマッピングに使用されるGrantedAuthoritiesMapper
setUserDetailsContextMapper
public void setUserDetailsContextMapper(UserDetailsContextMapper userDetailsContextMapper)
createSuccessfulAuthentication(org.springframework.security.authentication.UsernamePasswordAuthenticationToken, org.springframework.security.core.userdetails.UserDetails)メソッドによって返される Authentication のプリンシパルとして格納される UserDetails の作成にカスタム戦略を使用できるようにします。- パラメーター:
userDetailsContextMapper- 戦略インスタンス。設定されていない場合、デフォルトは単純な LdapUserDetailsMapper です。
getUserDetailsContextMapper
protected UserDetailsContextMapper getUserDetailsContextMapper()
サブクラスで使用するために注入されたUserDetailsContextMapper戦略へのアクセスを提供します。