沈斌
2018-02-08 3120cdd01c8e6a2a1edefb6ff251c026f44dee5c
updated
1 files modified
3 ■■■■ changed files
src/main/java/com/moral/security/auth/login/LoginAuthenticationProvider.java 3 ●●●● patch | view | raw | blame | history
src/main/java/com/moral/security/auth/login/LoginAuthenticationProvider.java
@@ -17,6 +17,7 @@
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -51,7 +52,7 @@
        String password = (String) authentication.getCredentials();
        LoginMode mode = (LoginMode) authentication.getDetails();
        Account account = accountService.queryAccountByName(accountName).orElseThrow(() -> new UsernameNotFoundException("User not found: " + accountName));
        if (!encoder.matches(password, account.getPassword())) {
        if (!encoder.matches(password, account.getPassword()) || account.getExpireTime().before(new Date())) {
            throw new BadCredentialsException("Authentication Failed. Username or Password not valid.");
        }