Search in sources :

Example 1 with IntrospectRequest

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

the class SyncSessionClientImplTest method introspectToken.

@Test
public void introspectToken() throws AuthorizationException, InterruptedException, OktaRepository.EncryptionException {
    mEndPoint.enqueueIntrospectSuccess();
    IntrospectRequest request = mSyncSessionClientImpl.introspectTokenRequest(ACCESS_TOKEN, TokenTypeHint.ACCESS_TOKEN, mOktaState.getProviderConfiguration());
    IntrospectInfo response = request.executeRequest(mHttpClient);
    assertTrue(response.isActive());
}
Also used : IntrospectRequest(com.okta.oidc.net.request.IntrospectRequest) IntrospectInfo(com.okta.oidc.net.response.IntrospectInfo) Test(org.junit.Test)

Example 2 with IntrospectRequest

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

the class SyncSessionClientImpl method introspectToken.

@Override
public IntrospectInfo introspectToken(String token, String tokenType) throws AuthorizationException {
    try {
        IntrospectRequest request = introspectTokenRequest(token, tokenType, 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) IntrospectRequest(com.okta.oidc.net.request.IntrospectRequest)

Example 3 with IntrospectRequest

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

the class SyncSessionClientImplTest method introspectTokenFailure.

@Test
public void introspectTokenFailure() throws AuthorizationException, InterruptedException, OktaRepository.EncryptionException {
    mExpectedEx.expect(AuthorizationException.class);
    mEndPoint.enqueueReturnInvalidClient();
    IntrospectRequest request = mSyncSessionClientImpl.introspectTokenRequest(ACCESS_TOKEN, TokenTypeHint.ACCESS_TOKEN, mOktaState.getProviderConfiguration());
    IntrospectInfo response = request.executeRequest(mHttpClient);
    assertNull(response);
}
Also used : IntrospectRequest(com.okta.oidc.net.request.IntrospectRequest) IntrospectInfo(com.okta.oidc.net.response.IntrospectInfo) Test(org.junit.Test)

Aggregations

IntrospectRequest (com.okta.oidc.net.request.IntrospectRequest)3 IntrospectInfo (com.okta.oidc.net.response.IntrospectInfo)2 Test (org.junit.Test)2 OktaRepository (com.okta.oidc.storage.OktaRepository)1