Make AccountStatusUserDetailsChecker implement MessageSourceAware
Fixes: gh-3980
This commit is contained in:
parent
98a8467e4c
commit
6f5fa1b610
|
@ -15,17 +15,20 @@
|
||||||
*/
|
*/
|
||||||
package org.springframework.security.authentication;
|
package org.springframework.security.authentication;
|
||||||
|
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.MessageSourceAware;
|
||||||
import org.springframework.security.core.SpringSecurityMessageSource;
|
import org.springframework.security.core.SpringSecurityMessageSource;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsChecker;
|
import org.springframework.security.core.userdetails.UserDetailsChecker;
|
||||||
import org.springframework.context.support.MessageSourceAccessor;
|
import org.springframework.context.support.MessageSourceAccessor;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
*/
|
*/
|
||||||
public class AccountStatusUserDetailsChecker implements UserDetailsChecker {
|
public class AccountStatusUserDetailsChecker implements UserDetailsChecker, MessageSourceAware {
|
||||||
|
|
||||||
protected final MessageSourceAccessor messages = SpringSecurityMessageSource
|
protected MessageSourceAccessor messages = SpringSecurityMessageSource
|
||||||
.getAccessor();
|
.getAccessor();
|
||||||
|
|
||||||
public void check(UserDetails user) {
|
public void check(UserDetails user) {
|
||||||
|
@ -51,4 +54,13 @@ public class AccountStatusUserDetailsChecker implements UserDetailsChecker {
|
||||||
"User credentials have expired"));
|
"User credentials have expired"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 5.2
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void setMessageSource(MessageSource messageSource) {
|
||||||
|
Assert.notNull(messageSource, "messageSource cannot be null");
|
||||||
|
this.messages = new MessageSourceAccessor(messageSource);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue