From d932522d375a4cd3ef032a143ef9c0b4a43aee90 Mon Sep 17 00:00:00 2001 From: Kamidu Sachith Date: Mon, 12 Oct 2015 18:03:13 +0530 Subject: [PATCH] refactoring class --- .../authenticator/backend/oauth/OauthAuthenticator.java | 4 ++-- .../backend/oauth/validator/OAuth2TokenValidator.java | 4 ++-- ...alidationRespond.java => OAuthValidationResponse.java} | 4 ++-- .../oauth/validator/impl/ExternalOAuthValidator.java | 8 ++++---- .../backend/oauth/validator/impl/LocalOAuthValidator.java | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) rename components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/{OAuthValidationRespond.java => OAuthValidationResponse.java} (92%) diff --git a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/OauthAuthenticator.java b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/OauthAuthenticator.java index adfcf71214..beaf5c70b0 100755 --- a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/OauthAuthenticator.java +++ b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/OauthAuthenticator.java @@ -24,9 +24,9 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.base.MultitenantConstants; import org.wso2.carbon.core.security.AuthenticatorsConfiguration; import org.wso2.carbon.core.services.authentication.CarbonServerAuthenticator; +import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidationResponse; import org.wso2.carbon.utils.ServerConstants; import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuth2TokenValidator; -import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidationRespond; import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidatorFactory; import javax.servlet.http.HttpServletRequest; @@ -94,7 +94,7 @@ public class OauthAuthenticator implements CarbonServerAuthenticator { String headerValue = httpServletRequest.getHeader(HTTPConstants.HEADER_AUTHORIZATION); String[] headerPart = headerValue.trim().split(OauthAuthenticatorConstants.SPLITING_CHARACTOR); String accessToken = headerPart[ACCESS_TOKEN_INDEX]; - OAuthValidationRespond response = null; + OAuthValidationResponse response = null; try { response = tokenValidator.validateToken(accessToken); } catch (RemoteException e) { diff --git a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuth2TokenValidator.java b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuth2TokenValidator.java index 7382fe1370..c0c5c8662a 100755 --- a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuth2TokenValidator.java +++ b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuth2TokenValidator.java @@ -28,7 +28,7 @@ public interface OAuth2TokenValidator { * containing the validity and user details if valid. * * @param accessToken which need to be validated. - * @return OAuthValidationRespond with the validated results. + * @return OAuthValidationResponse with the validated results. */ - OAuthValidationRespond validateToken(String accessToken) throws RemoteException; + OAuthValidationResponse validateToken(String accessToken) throws RemoteException; } diff --git a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuthValidationRespond.java b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuthValidationResponse.java similarity index 92% rename from components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuthValidationRespond.java rename to components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuthValidationResponse.java index 346ac2ac30..b794a22424 100755 --- a/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuthValidationRespond.java +++ b/components/identity-extensions/backend-oauth-authenticator/src/main/java/org/wso2/carbon/identity/authenticator/backend/oauth/validator/OAuthValidationResponse.java @@ -21,12 +21,12 @@ package org.wso2.carbon.identity.authenticator.backend.oauth.validator; * This class hold the validation information which can be retrieve by both remote and in house IDPs */ @SuppressWarnings("unused") -public class OAuthValidationRespond { +public class OAuthValidationResponse { private String userName; private String tenantDomain; private boolean isValid; - public OAuthValidationRespond(String userName, String tenantDomain, boolean isValid) { + public OAuthValidationResponse(String userName, String tenantDomain, boolean isValid) { this.userName = userName; this.tenantDomain = tenantDomain; this.isValid = isValid; 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 0c0836165e..be05c37fc8 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 @@ -23,7 +23,7 @@ import org.apache.axis2.transport.http.HTTPConstants; import org.apache.commons.httpclient.Header; import org.wso2.carbon.identity.authenticator.backend.oauth.OauthAuthenticatorConstants; import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuth2TokenValidator; -import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidationRespond; +import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidationResponse; import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub; import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2ClientApplicationDTO; import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO; @@ -49,9 +49,9 @@ public class ExternalOAuthValidator implements OAuth2TokenValidator{ * containing the validity and user details if valid. * * @param token which need to be validated. - * @return OAuthValidationRespond with the validated results. + * @return OAuthValidationResponse with the validated results. */ - public OAuthValidationRespond validateToken(String token) throws RemoteException { + public OAuthValidationResponse validateToken(String token) throws RemoteException { OAuth2TokenValidationRequestDTO validationRequest = new OAuth2TokenValidationRequestDTO(); OAuth2TokenValidationRequestDTO_OAuth2AccessToken accessToken = new OAuth2TokenValidationRequestDTO_OAuth2AccessToken(); @@ -80,6 +80,6 @@ public class ExternalOAuthValidator implements OAuth2TokenValidator{ tenantDomain = MultitenantUtils.getTenantDomain(respond.getAccessTokenValidationResponse().getAuthorizedUser()); } - return new OAuthValidationRespond(userName,tenantDomain,isValid); + 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 ea7edf1d13..fb6eb4b3b9 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 @@ -17,13 +17,13 @@ */ package org.wso2.carbon.identity.authenticator.backend.oauth.validator.impl; +import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidationResponse; import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; import org.wso2.carbon.identity.oauth2.dto.OAuth2ClientApplicationDTO; import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationRequestDTO; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; import org.wso2.carbon.identity.authenticator.backend.oauth.OauthAuthenticatorConstants; import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuth2TokenValidator; -import org.wso2.carbon.identity.authenticator.backend.oauth.validator.OAuthValidationRespond; /** * Handles the authentication using the inbuilt IS features. @@ -34,9 +34,9 @@ public class LocalOAuthValidator implements OAuth2TokenValidator { * containing the validity and user details if valid. * * @param token which need to be validated. - * @return OAuthValidationRespond with the validated results. + * @return OAuthValidationResponse with the validated results. */ - public OAuthValidationRespond validateToken(String token) { + public OAuthValidationResponse validateToken(String token) { OAuth2TokenValidationRequestDTO validationRequest = new OAuth2TokenValidationRequestDTO(); OAuth2TokenValidationRequestDTO.OAuth2AccessToken accessToken = validationRequest.new OAuth2AccessToken(); @@ -55,6 +55,6 @@ public class LocalOAuthValidator implements OAuth2TokenValidator { tenantDomain = MultitenantUtils.getTenantDomain(respond.getAccessTokenValidationResponse().getAuthorizedUser()); } - return new OAuthValidationRespond(userName,tenantDomain,isValid); + return new OAuthValidationResponse(userName,tenantDomain,isValid); } }