public class OpenIDAuthenticationProvider extends java.lang.Object implements AuthenticationProvider, org.springframework.beans.factory.InitializingBean
権限は、構成された UserDetailsService を呼び出すことによって取得されます。返される UserDetails には、少なくとも、認証されたユーザーに適用可能なユーザー名と GrantedAuthority オブジェクトが含まれている必要があります。デフォルトでは、Spring Security はパスワードと UserDetails の有効 / 無効ステータスを無視します。これは認証に関連し、別のプロバイダーサーバーによって強制されているはずです。
実装によって返される UserDetails は、生成された Authentication トークンに格納されるため、メールアドレス、電話番号などの追加のプロパティを簡単に格納できます。
| コンストラクターと説明 |
|---|
OpenIDAuthenticationProvider() |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | afterPropertiesSet() |
Authentication | authenticate(Authentication authentication)AuthenticationManager.authenticate(Authentication) と同じ契約で認証を実行します。 |
protected Authentication | createSuccessfulAuthentication(UserDetails userDetails, OpenIDAuthenticationToken auth) プロバイダーから返される最終的な Authentication オブジェクトの作成を処理します。 |
void | setAuthenticationUserDetailsService(AuthenticationUserDetailsService<OpenIDAuthenticationToken> userDetailsService) 認証された OpenID ユーザーの UserDetails をロードするために使用されます。 |
void | setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper) |
void | setUserDetailsService(UserDetailsService userDetailsService) 認証された OpenID ユーザーの UserDetails をロードするために使用されます。 |
boolean | supports(java.lang.Class<?> authentication) この AuthenticationProvider が指定された Authentication オブジェクトをサポートする場合、true を返します。 |
public void afterPropertiesSet()
org.springframework.beans.factory.InitializingBean 内の afterPropertiesSet public Authentication authenticate(Authentication authentication) throws AuthenticationException
AuthenticationProviderAuthenticationManager.authenticate(Authentication) と同じ契約で認証を実行します。AuthenticationProvider 内の authenticate authentication - 認証リクエストオブジェクト。AuthenticationProvider が、渡された Authentication オブジェクトの認証をサポートできない場合、null を返すことがあります。そのような場合、提示された Authentication クラスをサポートする次の AuthenticationProvider が試行されます。AuthenticationException - 認証が失敗した場合。protected Authentication createSuccessfulAuthentication(UserDetails userDetails, OpenIDAuthenticationToken auth)
デフォルトの実装は、オリジナルから新しい OpenIDAuthenticationToken を作成するだけですが、UserDetails をプリンシパルとして使用し、UserDetailsService によってロードされた権限を含めます。
userDetails - ロードされた UserDetails オブジェクト auth - 認証メソッドに渡されるトークン public void setUserDetailsService(UserDetailsService userDetailsService)
UserDetails をロードするために使用されます。public void setAuthenticationUserDetailsService(AuthenticationUserDetailsService<OpenIDAuthenticationToken> userDetailsService)
UserDetails をロードするために使用されます。public boolean supports(java.lang.Class<?> authentication)
AuthenticationProviderAuthenticationProvider が指定された Authentication オブジェクトをサポートする場合、true を返します。true を返すことは、AuthenticationProvider が Authentication クラスの提示されたインスタンスを認証できることを保証しません。それは、それがより詳細な評価をサポートできることを示しています。AuthenticationProvider は、AuthenticationProvider.authenticate(Authentication) メソッドから null を返して、別の AuthenticationProvider を試す必要があることを示すことができます。
認証を実行できる AuthenticationProvider の選択は、実行時に ProviderManager で行われます。
AuthenticationProvider 内の supports Authentication クラスをより厳密に評価できる場合は true public void setAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper)