Search in sources :

Example 1 with OAuth2TokenValidationRequestDTO_OAuth2AccessToken

use of org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_OAuth2AccessToken in project airavata by apache.

the class DefaultOAuthClient method validateAccessToken.

/**
 * Validates the OAuth 2.0 access token
 *
 * @param accessToken
 * @return
 * @throws Exception
 */
public OAuth2TokenValidationResponseDTO validateAccessToken(String accessToken) throws AiravataSecurityException {
    try {
        OAuth2TokenValidationRequestDTO oauthReq = new OAuth2TokenValidationRequestDTO();
        OAuth2TokenValidationRequestDTO_OAuth2AccessToken token = new OAuth2TokenValidationRequestDTO_OAuth2AccessToken();
        token.setIdentifier(accessToken);
        token.setTokenType(BEARER_TOKEN_TYPE);
        oauthReq.setAccessToken(token);
        return stub.validate(oauthReq);
    } catch (RemoteException e) {
        logger.error(e.getMessage(), e);
        throw new AiravataSecurityException("Error in validating the OAuth access token.");
    }
}
Also used : OAuth2TokenValidationRequestDTO_OAuth2AccessToken(org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_OAuth2AccessToken) RemoteException(java.rmi.RemoteException) AiravataSecurityException(org.apache.airavata.security.AiravataSecurityException) OAuth2TokenValidationRequestDTO(org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO)

Aggregations

RemoteException (java.rmi.RemoteException)1 AiravataSecurityException (org.apache.airavata.security.AiravataSecurityException)1 OAuth2TokenValidationRequestDTO (org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO)1 OAuth2TokenValidationRequestDTO_OAuth2AccessToken (org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_OAuth2AccessToken)1