优化代码

springboot3
RuoYi 2 weeks ago
parent eb2e089d57
commit 1f0eb72a58

@ -20,7 +20,7 @@ public class SecurityConstants
/**
*
*/
public static final String AUTHORIZATION_HEADER = "authorization";
public static final String AUTHORIZATION_HEADER = "Authorization";
/**
*

@ -7,11 +7,6 @@ package com.ruoyi.common.core.constant;
*/
public class TokenConstants
{
/**
*
*/
public static final String AUTHENTICATION = "Authorization";
/**
*
*/

@ -62,7 +62,7 @@ public class SecurityUtils
public static String getToken(HttpServletRequest request)
{
// 从header获取token标识
String token = request.getHeader(TokenConstants.AUTHENTICATION);
String token = request.getHeader(SecurityConstants.AUTHORIZATION_HEADER);
return replaceTokenPrefix(token);
}

@ -118,7 +118,7 @@ public class AuthFilter implements GlobalFilter, Ordered
*/
private String getToken(ServerHttpRequest request)
{
String token = request.getHeaders().getFirst(TokenConstants.AUTHENTICATION);
String token = request.getHeaders().getFirst(SecurityConstants.AUTHORIZATION_HEADER);
// 如果前端设置了令牌前缀,则裁剪掉前缀
if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX))
{

Loading…
Cancel
Save