Search in sources :

Example 1 with RevokeTokenRequest

use of com.okta.oidc.net.request.RevokeTokenRequest in project okta-oidc-android by okta.

the class SyncSessionClientImplTest method revokeTokenRequest.

@Test
public void revokeTokenRequest() throws AuthorizationException, InterruptedException, OktaRepository.EncryptionException {
    mEndPoint.enqueueReturnSuccessEmptyBody();
    RevokeTokenRequest request = mSyncSessionClientImpl.revokeTokenRequest("access_token", mOktaState.getProviderConfiguration());
    boolean status = request.executeRequest(mHttpClient);
    RecordedRequest recordedRequest = mEndPoint.takeRequest();
    assertThat(recordedRequest.getPath(), equalTo("/revoke?client_id=CLIENT_ID&token=access_token"));
    assertTrue(status);
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) RevokeTokenRequest(com.okta.oidc.net.request.RevokeTokenRequest) Test(org.junit.Test)

Example 2 with RevokeTokenRequest

use of com.okta.oidc.net.request.RevokeTokenRequest in project okta-oidc-android by okta.

the class SyncSessionClientImpl method revokeToken.

@Override
public Boolean revokeToken(String token) throws AuthorizationException {
    try {
        RevokeTokenRequest request = revokeTokenRequest(token, mOktaState.getProviderConfiguration());
        mCurrentRequest.set(new WeakReference<>(request));
        return request.executeRequest(mHttpClient);
    } catch (OktaRepository.EncryptionException e) {
        throw AuthorizationException.EncryptionErrors.byEncryptionException(e);
    }
}
Also used : OktaRepository(com.okta.oidc.storage.OktaRepository) RevokeTokenRequest(com.okta.oidc.net.request.RevokeTokenRequest)

Example 3 with RevokeTokenRequest

use of com.okta.oidc.net.request.RevokeTokenRequest in project okta-oidc-android by okta.

the class SyncSessionClientImplTest method revokeTokenRequestFailure.

@Test
public void revokeTokenRequestFailure() throws AuthorizationException, InterruptedException, AuthorizationException, OktaRepository.EncryptionException {
    mExpectedEx.expect(AuthorizationException.class);
    mEndPoint.enqueueReturnInvalidClient();
    RevokeTokenRequest request = mSyncSessionClientImpl.revokeTokenRequest("access_token", mOktaState.getProviderConfiguration());
    boolean status = request.executeRequest(mHttpClient);
    RecordedRequest recordedRequest = mEndPoint.takeRequest();
    assertFalse(status);
    assertThat(recordedRequest.getPath(), equalTo("/revoke?client_id=CLIENT_ID&token=access_token"));
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) RevokeTokenRequest(com.okta.oidc.net.request.RevokeTokenRequest) Test(org.junit.Test)

Aggregations

RevokeTokenRequest (com.okta.oidc.net.request.RevokeTokenRequest)3 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)2 Test (org.junit.Test)2 OktaRepository (com.okta.oidc.storage.OktaRepository)1