优化代码
This commit is contained in:
parent
bec5600f16
commit
856c471472
@ -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 class TokenConstants
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 令牌自定义标识
|
|
||||||
*/
|
|
||||||
public static final String AUTHENTICATION = "Authorization";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 令牌前缀
|
* 令牌前缀
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -62,7 +62,7 @@ public class SecurityUtils
|
|||||||
public static String getToken(HttpServletRequest request)
|
public static String getToken(HttpServletRequest request)
|
||||||
{
|
{
|
||||||
// 从header获取token标识
|
// 从header获取token标识
|
||||||
String token = request.getHeader(TokenConstants.AUTHENTICATION);
|
String token = request.getHeader(SecurityConstants.AUTHORIZATION_HEADER);
|
||||||
return replaceTokenPrefix(token);
|
return replaceTokenPrefix(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -118,7 +118,7 @@ public class AuthFilter implements GlobalFilter, Ordered
|
|||||||
*/
|
*/
|
||||||
private String getToken(ServerHttpRequest request)
|
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))
|
if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -130,7 +130,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isImg) {
|
if (!isImg) {
|
||||||
this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}图片格式文件!`);
|
this.$modal.msgError(`文件格式不正确,请上传${this.fileType.join("/")}图片格式文件!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (file.name.includes(',')) {
|
if (file.name.includes(',')) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user