From 743f394fb98485840968a26fd4fdc49979c33f6e Mon Sep 17 00:00:00 2001 From: Kamidu Sachith Date: Mon, 12 Oct 2015 18:11:44 +0530 Subject: [PATCH] Requested Modifications --- .../impl/ExternalOAuthValidator.java | 20 +++++++++---------- .../validator/impl/LocalOAuthValidator.java | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/impl/ExternalOAuthValidator.java b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/impl/ExternalOAuthValidator.java index be05c37fc8..f05bd7dea0 100755 --- a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/impl/ExternalOAuthValidator.java +++ b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/impl/ExternalOAuthValidator.java @@ -58,27 +58,27 @@ public class ExternalOAuthValidator implements OAuth2TokenValidator{ accessToken.setTokenType(OauthAuthenticatorConstants.BEARER_TOKEN_TYPE); accessToken.setIdentifier(token); validationRequest.setAccessToken(accessToken); - OAuth2TokenValidationServiceStub validationService = + OAuth2TokenValidationServiceStub tokenValidationService = new OAuth2TokenValidationServiceStub(hostURL); - ServiceClient client = validationService._getServiceClient(); + ServiceClient client = tokenValidationService._getServiceClient(); Options options = client.getOptions(); - List
list = new ArrayList<>(); + List
headerList = new ArrayList<>(); Header header = new Header(); header.setName(HTTPConstants.HEADER_AUTHORIZATION); header.setValue(OauthAuthenticatorConstants.AUTHORIZATION_HEADER_PREFIX_BEARER+ " " + token); - list.add(header); - options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS, list); + headerList.add(header); + options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS, headerList); client.setOptions(options); - OAuth2ClientApplicationDTO respond = - validationService.findOAuthConsumerIfTokenIsValid(validationRequest); - boolean isValid = respond.getAccessTokenValidationResponse().getValid(); + OAuth2ClientApplicationDTO clientApplicationDTO = + tokenValidationService.findOAuthConsumerIfTokenIsValid(validationRequest); + boolean isValid = clientApplicationDTO.getAccessTokenValidationResponse().getValid(); String userName = null; String tenantDomain = null; if(isValid){ userName = MultitenantUtils.getTenantAwareUsername( - respond.getAccessTokenValidationResponse().getAuthorizedUser()); + clientApplicationDTO.getAccessTokenValidationResponse().getAuthorizedUser()); tenantDomain = - MultitenantUtils.getTenantDomain(respond.getAccessTokenValidationResponse().getAuthorizedUser()); + MultitenantUtils.getTenantDomain(clientApplicationDTO.getAccessTokenValidationResponse().getAuthorizedUser()); } return new OAuthValidationResponse(userName,tenantDomain,isValid); } diff --git a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/impl/LocalOAuthValidator.java b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/impl/LocalOAuthValidator.java index fb6eb4b3b9..5595b19d43 100755 --- a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/impl/LocalOAuthValidator.java +++ b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/impl/LocalOAuthValidator.java @@ -44,16 +44,16 @@ public class LocalOAuthValidator implements OAuth2TokenValidator { accessToken.setIdentifier(token); validationRequest.setAccessToken(accessToken); OAuth2TokenValidationService validationService = new OAuth2TokenValidationService(); - OAuth2ClientApplicationDTO respond = validationService. + OAuth2ClientApplicationDTO clientApplicationDTO = validationService. findOAuthConsumerIfTokenIsValid(validationRequest); - boolean isValid = respond.getAccessTokenValidationResponse().isValid(); + boolean isValid = clientApplicationDTO.getAccessTokenValidationResponse().isValid(); String userName = null; String tenantDomain = null; if(isValid){ userName = MultitenantUtils.getTenantAwareUsername( - respond.getAccessTokenValidationResponse().getAuthorizedUser()); + clientApplicationDTO.getAccessTokenValidationResponse().getAuthorizedUser()); tenantDomain = - MultitenantUtils.getTenantDomain(respond.getAccessTokenValidationResponse().getAuthorizedUser()); + MultitenantUtils.getTenantDomain(clientApplicationDTO.getAccessTokenValidationResponse().getAuthorizedUser()); } return new OAuthValidationResponse(userName,tenantDomain,isValid); }