|
@@ -1,5 +1,6 @@
|
|
|
package com.tofly.auth.oauth;
|
|
|
|
|
|
+import cn.hutool.crypto.SecureUtil;
|
|
|
import com.tofly.auth.util.RSAUtils;
|
|
|
import com.tofly.common.core.constant.CommonConstants;
|
|
|
import com.tofly.common.core.constant.SecurityConstants;
|
|
@@ -28,6 +29,7 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.security.Security;
|
|
|
import java.util.Collection;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
@@ -89,7 +91,16 @@ public class ToflyAuthenticationProvider implements AuthenticationProvider {
|
|
|
|
|
|
log.info("用{}加密后的密码为:{}", SecurityConstants.BCRYPT+password,bCryptPasswordEncoder.encode(SecurityConstants.BCRYPT+password));
|
|
|
boolean flag = bCryptPasswordEncoder.matches(SecurityConstants.BCRYPT+password, userDetails.getPassword());
|
|
|
+ if(!flag){
|
|
|
+ String sha1 = SecureUtil.sha1(password);
|
|
|
+ log.info("sha1加密:{}",sha1);
|
|
|
+ boolean matches = bCryptPasswordEncoder.matches(SecurityConstants.BCRYPT + sha1, userDetails.getPassword());
|
|
|
+ if(matches){
|
|
|
+ password = sha1;
|
|
|
+ flag = true;
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
if(StringUtil.isEmpty(password) && !flag){
|