完善微服务授权

This commit is contained in:
启航 2024-01-22 18:25:09 +08:00
parent 67ccc91f42
commit ab7d40df49
1 changed files with 3 additions and 3 deletions

View File

@ -29,8 +29,8 @@ import java.util.concurrent.TimeUnit;
public class TokenService public class TokenService
{ {
// 令牌自定义标识 // 令牌自定义标识
@Value("${token.header:'Authorization'}") // @Value("${token.header:'Authorization'}")
private String header; // private String header;
// 令牌秘钥 // 令牌秘钥
@Value("${token.secret:'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkrstuvwxyzabcdefghijklmnopqrstuvwxyz'}") @Value("${token.secret:'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkrstuvwxyzabcdefghijklmnopqrstuvwxyz'}")
@ -210,7 +210,7 @@ public class TokenService
*/ */
private String getToken(HttpServletRequest request) private String getToken(HttpServletRequest request)
{ {
String token = request.getHeader(header); String token = request.getHeader("Authorization");
// if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) // if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
// { // {
// token = token.replace(Constants.TOKEN_PREFIX, ""); // token = token.replace(Constants.TOKEN_PREFIX, "");