msf4j oauth2-security is throwing null pointer exception

64 Views Asked by At

When I am trying to validate the token, oauth2-security msf4j returns null pointer exception, without giving any more detail. On debugging it appears that getValidatedTokenResponse is returning empty and so NPE is coming: I verified the token and configuration, and everything seems to be fine.

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;
        }
    }

When I used spring security to verify the token, it worked fine..

0

There are 0 best solutions below