当我尝试验证令牌时,oauth2-security msf4j返回空指针异常,而不提供任何更多细节。在调试时,似乎getValidatedTokenResponse返回空,因此NPE即将到来:我验证了令牌和配置,一切似乎都没问题。
private boolean validateToken(String authHeader) throws MSF4JSecurityException {
String accessToken = this.extractAccessToken(authHeader);
String responseStr = this.getValidatedTokenResponse(accessToken);
Map responseData = this.getResponseDataMap(responseStr);
if(!Boolean.parseBoolean((String)responseData.get("active"))) {
throw new MSF4JSecurityException(SecurityErrorCode.AUTHENTICATION_FAILURE, "Invalid Access token.");
} else {
return true;
}
}
当我使用spring security来验证令牌时,它工作得很好..