mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 05:00:25 +08:00
commit
d7f39cbc14
@ -10,10 +10,11 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.logging.log4j.util.Strings;
|
import org.apache.logging.log4j.util.Strings;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
import sun.misc.BASE64Decoder;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Base64;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,7 +80,7 @@ public class JwtUtils {
|
|||||||
String basic = request.getHeader(AuthConstants.AUTHORIZATION_KEY);
|
String basic = request.getHeader(AuthConstants.AUTHORIZATION_KEY);
|
||||||
if (StrUtil.isNotBlank(basic) && basic.startsWith(AuthConstants.BASIC_PREFIX)) {
|
if (StrUtil.isNotBlank(basic) && basic.startsWith(AuthConstants.BASIC_PREFIX)) {
|
||||||
basic = basic.replace(AuthConstants.BASIC_PREFIX, Strings.EMPTY);
|
basic = basic.replace(AuthConstants.BASIC_PREFIX, Strings.EMPTY);
|
||||||
String basicPlainText = new String(new BASE64Decoder().decodeBuffer(basic), StandardCharsets.UTF_8);
|
String basicPlainText = new String(Base64.getDecoder().decode(basic.getBytes(StandardCharsets.UTF_8)), StandardCharsets.UTF_8);
|
||||||
clientId = basicPlainText.split(":")[0]; //client:secret
|
clientId = basicPlainText.split(":")[0]; //client:secret
|
||||||
}
|
}
|
||||||
return clientId;
|
return clientId;
|
||||||
|
Loading…
Reference in New Issue
Block a user