mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-04 09:42:29 +00:00
SEC-1037: Made LdapAuthenticationProvider implement MessageSourceAware.
This commit is contained in:
parent
843d0e6910
commit
d508adbf8b
@ -32,6 +32,8 @@ import org.springframework.security.userdetails.UsernameNotFoundException;
|
|||||||
import org.springframework.security.userdetails.ldap.LdapUserDetailsMapper;
|
import org.springframework.security.userdetails.ldap.LdapUserDetailsMapper;
|
||||||
import org.springframework.security.userdetails.ldap.UserDetailsContextMapper;
|
import org.springframework.security.userdetails.ldap.UserDetailsContextMapper;
|
||||||
import org.springframework.security.util.AuthorityUtils;
|
import org.springframework.security.util.AuthorityUtils;
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.MessageSourceAware;
|
||||||
import org.springframework.context.support.MessageSourceAccessor;
|
import org.springframework.context.support.MessageSourceAccessor;
|
||||||
import org.springframework.ldap.NamingException;
|
import org.springframework.ldap.NamingException;
|
||||||
import org.springframework.ldap.core.DirContextOperations;
|
import org.springframework.ldap.core.DirContextOperations;
|
||||||
@ -125,7 +127,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
* @see org.springframework.security.providers.ldap.authenticator.BindAuthenticator
|
* @see org.springframework.security.providers.ldap.authenticator.BindAuthenticator
|
||||||
* @see DefaultLdapAuthoritiesPopulator
|
* @see DefaultLdapAuthoritiesPopulator
|
||||||
*/
|
*/
|
||||||
public class LdapAuthenticationProvider implements AuthenticationProvider {
|
public class LdapAuthenticationProvider implements AuthenticationProvider, MessageSourceAware {
|
||||||
//~ Static fields/initializers =====================================================================================
|
//~ Static fields/initializers =====================================================================================
|
||||||
|
|
||||||
private static final Log logger = LogFactory.getLog(LdapAuthenticationProvider.class);
|
private static final Log logger = LogFactory.getLog(LdapAuthenticationProvider.class);
|
||||||
@ -211,6 +213,10 @@ public class LdapAuthenticationProvider implements AuthenticationProvider {
|
|||||||
this.useAuthenticationRequestCredentials = useAuthenticationRequestCredentials;
|
this.useAuthenticationRequestCredentials = useAuthenticationRequestCredentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMessageSource(MessageSource messageSource) {
|
||||||
|
this.messages = new MessageSourceAccessor(messageSource);
|
||||||
|
}
|
||||||
|
|
||||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||||
Assert.isInstanceOf(UsernamePasswordAuthenticationToken.class, authentication,
|
Assert.isInstanceOf(UsernamePasswordAuthenticationToken.class, authentication,
|
||||||
messages.getMessage("AbstractUserDetailsAuthenticationProvider.onlySupports",
|
messages.getMessage("AbstractUserDetailsAuthenticationProvider.onlySupports",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user