Skip to content

Commit

Permalink
🎉 3.7.0.RELEASE Token加密传输
Browse files Browse the repository at this point in the history
  • Loading branch information
smallchill committed Sep 12, 2023
1 parent 85daa7e commit 72b33cd
Showing 1 changed file with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,44 @@ public static String getBase64Security() {
}

/**
* 判断token类型为crypto
* 获取请求传递的token串
*
* @param auth token
* @return String
*/
public static Boolean isCrypto(String auth) {
public static String getToken(String auth) {
if (isBearer(auth) || isCrypto(auth)) {
return auth.substring(AUTH_LENGTH);
}
return null;
}

/**
* 判断token类型为bearer
*
* @param auth token
* @return String
*/
public static Boolean isBearer(String auth) {
if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
String headStr = auth.substring(0, 6).toLowerCase();
return headStr.compareTo(CRYPTO) == 0;
return headStr.compareTo(BEARER) == 0;
}
return false;
}

/**
* 获取token串
* 判断token类型为crypto
*
* @param auth token
* @return String
*/
public static String getToken(String auth) {
public static Boolean isCrypto(String auth) {
if ((auth != null) && (auth.length() > AUTH_LENGTH)) {
String headStr = auth.substring(0, 6).toLowerCase();
if (headStr.compareTo(BEARER) == 0) {
auth = auth.substring(7);
}
return auth;
return headStr.compareTo(CRYPTO) == 0;
}
return null;
return false;
}

/**
Expand Down

0 comments on commit 72b33cd

Please sign in to comment.