♻️ 重构代码

This commit is contained in:
冷冷 2018-06-06 13:43:55 +08:00
parent 5b1294e0d1
commit e11a483ac4
1 changed files with 1 additions and 17 deletions

View File

@ -78,22 +78,6 @@ public class AuthUtils {
throw new CheckedException("请求头中client信息为空");
}
byte[] base64Token = header.substring(6).getBytes("UTF-8");
byte[] decoded;
try {
decoded = Base64.decode(base64Token);
} catch (IllegalArgumentException e) {
throw new CheckedException(
"Failed to decode basic authentication token");
}
String token = new String(decoded, CommonConstant.UTF8);
int delim = token.indexOf(":");
if (delim == -1) {
throw new CheckedException("Invalid basic authentication token");
}
return new String[]{token.substring(0, delim), token.substring(delim + 1)};
return extractAndDecodeHeader(header);
}
}