クラス 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.Log
logger
protected org.springframework.context.support.MessageSourceAccessor
messages
protected UserDetailsContextMapper
userDetailsContextMapper
コンストラクターの概要
コンストラクター コンストラクター 説明 AbstractLdapAuthenticationProvider()
メソッドのサマリー
すべてのメソッド インスタンスメソッド 抽象メソッド 具象メソッド 修飾子と型 メソッド 説明 Authentication
authenticate(Authentication authentication)
AuthenticationManager.authenticate(Authentication)
と同じ契約で認証を実行します。protected Authentication
createSuccessfulAuthentication(UsernamePasswordAuthenticationToken authentication, UserDetails user)
authenticate
メソッドから返される最終的なAuthentication
オブジェクトを作成します。protected abstract org.springframework.ldap.core.DirContextOperations
doAuthentication(UsernamePasswordAuthenticationToken auth)
protected UserDetailsContextMapper
getUserDetailsContextMapper()
サブクラスで使用するために注入されたUserDetailsContextMapper
戦略へのアクセスを提供します。protected abstract java.util.Collection<? extends GrantedAuthority>
loadUserAuthorities(org.springframework.ldap.core.DirContextOperations userData, java.lang.String username, java.lang.String password)
void
setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper)
ストレージからロードされた権限を、UsernamePasswordAuthenticationToken
に関連付けられる新しい権限のセットに変換するために使用されるGrantedAuthoritiesMapper
を設定します。void
setMessageSource(org.springframework.context.MessageSource messageSource)
void
setUseAuthenticationRequestCredentials(boolean useAuthenticationRequestCredentials)
提供されたパスワードを、成功した認証トークンの資格情報として使用するかどうかを決定します。void
setUserDetailsContextMapper(UserDetailsContextMapper userDetailsContextMapper)
createSuccessfulAuthentication(org.springframework.security.authentication.UsernamePasswordAuthenticationToken, org.springframework.security.core.userdetails.UserDetails)
メソッドによって返される Authentication のプリンシパルとして格納される UserDetails の作成にカスタム戦略を使用できるようにします。boolean
supports(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
インターフェースからコピーされた説明:AuthenticationProvider
AuthenticationManager.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
戦略へのアクセスを提供します。