Fixed NPE in API publisher client (#882)

revert-70aa11f8
Milan Perera 7 years ago committed by Madhawa Perera
parent 7abc9e5844
commit 25840a1279

@ -101,6 +101,10 @@ public class OAuthRequestInterceptor implements RequestInterceptor {
REQUIRED_SCOPE); REQUIRED_SCOPE);
tenantBasedAccessTokenInfo.setExpiresIn( tenantBasedAccessTokenInfo.setExpiresIn(
System.currentTimeMillis() + (tenantBasedAccessTokenInfo.getExpiresIn() * 1000)); System.currentTimeMillis() + (tenantBasedAccessTokenInfo.getExpiresIn() * 1000));
if (tenantBasedAccessTokenInfo.getScopes() == null) {
throw new APIMClientOAuthException("Failed to retrieve scopes from access token");
}
if (tenantBasedAccessTokenInfo.getScopes().contains(APIM_SUBSCRIBE_SCOPE)) { if (tenantBasedAccessTokenInfo.getScopes().contains(APIM_SUBSCRIBE_SCOPE)) {
tenantUserTokenMap.put(username, tenantBasedAccessTokenInfo); tenantUserTokenMap.put(username, tenantBasedAccessTokenInfo);
} }

@ -35,7 +35,7 @@ public class APIMClientOAuthException extends RuntimeException {
this.responseStatus = status; this.responseStatus = status;
} }
APIMClientOAuthException(String message) { public APIMClientOAuthException(String message) {
super(message); super(message);
} }

Loading…
Cancel
Save