0

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..

krmanish007
  • 6,749
  • 16
  • 58
  • 100
  • What is the MSF4J version that you are using? Can you check with MSF4J 2.1.0 https://github.com/wso2/msf4j/blob/v2.1.0/core/src/main/java/org/wso2/msf4j/security/oauth2/OAuth2SecurityInterceptor.java Also please share the logs – Thusitha Thilina Dayaratne Jan 11 '17 at 01:04
  • 1
    The problem resolved now. introspect war hadn't deployed correctly, so I deployed it again in the server, and this problem resolved. – krmanish007 Jan 11 '17 at 10:51

0 Answers0