refactoring class

4.x.x
Kamidu Sachith 9 years ago
parent 8cc38c87f5
commit d932522d37

@ -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) {

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

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

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

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

Loading…
Cancel
Save