|
|
@ -20,6 +20,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Comparator; |
|
|
|
import java.util.Comparator; |
|
|
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Optional; |
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
|
|
|
|
@ -49,7 +50,7 @@ public class KiccDaoAuthenticationProvider extends AbstractUserDetailsAuthentica |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private volatile String userNotFoundEncodedPassword; |
|
|
|
private volatile String userNotFoundEncodedPassword; |
|
|
|
|
|
|
|
|
|
|
|
private UserDetailsService userDetailsService; |
|
|
|
private KiccUserDetailsService userDetailsService; |
|
|
|
|
|
|
|
|
|
|
|
private UserDetailsPasswordService userDetailsPasswordService; |
|
|
|
private UserDetailsPasswordService userDetailsPasswordService; |
|
|
|
|
|
|
|
|
|
|
@ -79,7 +80,7 @@ public class KiccDaoAuthenticationProvider extends AbstractUserDetailsAuthentica |
|
|
|
throws AuthenticationException { |
|
|
|
throws AuthenticationException { |
|
|
|
prepareTimingAttackProtection(); |
|
|
|
prepareTimingAttackProtection(); |
|
|
|
|
|
|
|
|
|
|
|
// 此处已获得 客户端认证 获取对应 userDetailsService
|
|
|
|
// 此处已获得 客户端认证 获取对应 KiccUserDetailsService
|
|
|
|
Authentication clientAuthentication = SecurityContextHolder.getContext().getAuthentication(); |
|
|
|
Authentication clientAuthentication = SecurityContextHolder.getContext().getAuthentication(); |
|
|
|
|
|
|
|
|
|
|
|
// SSO NPE 处理
|
|
|
|
// SSO NPE 处理
|
|
|
@ -101,7 +102,7 @@ public class KiccDaoAuthenticationProvider extends AbstractUserDetailsAuthentica |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
UserDetails loadedUser = optional.get().loadUserByUsername(username); |
|
|
|
UserDetails loadedUser = optional.get().loadUserByParam(username, (LinkedHashMap<String, String>)authentication.getCredentials()); |
|
|
|
if (loadedUser == null) { |
|
|
|
if (loadedUser == null) { |
|
|
|
throw new InternalAuthenticationServiceException( |
|
|
|
throw new InternalAuthenticationServiceException( |
|
|
|
"UserDetailsService returned null, which is an interface contract violation"); |
|
|
|
"UserDetailsService returned null, which is an interface contract violation"); |
|
|
@ -158,11 +159,11 @@ public class KiccDaoAuthenticationProvider extends AbstractUserDetailsAuthentica |
|
|
|
return this.passwordEncoder; |
|
|
|
return this.passwordEncoder; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setUserDetailsService(UserDetailsService userDetailsService) { |
|
|
|
public void setUserDetailsService(KiccUserDetailsService userDetailsService) { |
|
|
|
this.userDetailsService = userDetailsService; |
|
|
|
this.userDetailsService = userDetailsService; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
protected UserDetailsService getUserDetailsService() { |
|
|
|
protected KiccUserDetailsService getUserDetailsService() { |
|
|
|
return this.userDetailsService; |
|
|
|
return this.userDetailsService; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|