public class OpenIDAuthenticationProvider extends Object implements org.springframework.security.authentication.AuthenticationProvider, InitializingBean
The authorities are obtained by calling the configured UserDetailsService
.
The UserDetails
it returns must, at minimum, contain the username and GrantedAuthority
objects applicable to the authenticated user. Note that by default, Spring Security ignores the password and
enabled/disabled status of the UserDetails
because this is authentication-related and should have been
enforced by another provider server.
The UserDetails
returned by implementations is stored in the generated Authentication
token,
so additional properties such as email addresses, telephone numbers etc can easily be stored.
Constructor and Description |
---|
OpenIDAuthenticationProvider() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
org.springframework.security.core.Authentication |
authenticate(org.springframework.security.core.Authentication authentication) |
protected org.springframework.security.core.Authentication |
createSuccessfulAuthentication(org.springframework.security.core.userdetails.UserDetails userDetails,
OpenIDAuthenticationToken auth)
Handles the creation of the final Authentication object which will be returned by the provider.
|
void |
setAuthenticationUserDetailsService(org.springframework.security.core.userdetails.AuthenticationUserDetailsService<OpenIDAuthenticationToken> userDetailsService)
Used to load the
UserDetails for the authenticated OpenID user. |
void |
setAuthoritiesMapper(org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper authoritiesMapper) |
void |
setUserDetailsService(org.springframework.security.core.userdetails.UserDetailsService userDetailsService)
Used to load the
UserDetails for the authenticated OpenID user. |
boolean |
supports(Class<?> authentication) |
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication) throws org.springframework.security.core.AuthenticationException
authenticate
in interface org.springframework.security.authentication.AuthenticationProvider
org.springframework.security.core.AuthenticationException
protected org.springframework.security.core.Authentication createSuccessfulAuthentication(org.springframework.security.core.userdetails.UserDetails userDetails, OpenIDAuthenticationToken auth)
The default implementation just creates a new OpenIDAuthenticationToken from the original, but with the UserDetails as the principal and including the authorities loaded by the UserDetailsService.
userDetails
- the loaded UserDetails objectauth
- the token passed to the authenticate method, containingpublic void setUserDetailsService(org.springframework.security.core.userdetails.UserDetailsService userDetailsService)
UserDetails
for the authenticated OpenID user.public void setAuthenticationUserDetailsService(org.springframework.security.core.userdetails.AuthenticationUserDetailsService<OpenIDAuthenticationToken> userDetailsService)
UserDetails
for the authenticated OpenID user.public boolean supports(Class<?> authentication)
supports
in interface org.springframework.security.authentication.AuthenticationProvider
public void setAuthoritiesMapper(org.springframework.security.core.authority.mapping.GrantedAuthoritiesMapper authoritiesMapper)