Search in sources :

Example 6 with IntrospectInfo

use of com.okta.oidc.net.response.IntrospectInfo in project okta-oidc-android by okta.

the class SessionClientImplTest method introspectToken.

@Test
public void introspectToken() throws InterruptedException {
    mEndPoint.enqueueIntrospectSuccess();
    final CountDownLatch latch = new CountDownLatch(1);
    MockRequestCallback<IntrospectInfo, AuthorizationException> cb = new MockRequestCallback<>(latch);
    mSessionClient.introspectToken(ACCESS_TOKEN, TokenTypeHint.ACCESS_TOKEN, cb);
    latch.await();
    assertNotNull(cb.getResult());
    assertTrue(cb.getResult().isActive());
}
Also used : MockRequestCallback(com.okta.oidc.util.MockRequestCallback) AuthorizationException(com.okta.oidc.util.AuthorizationException) CountDownLatch(java.util.concurrent.CountDownLatch) IntrospectInfo(com.okta.oidc.net.response.IntrospectInfo) Test(org.junit.Test)

Example 7 with IntrospectInfo

use of com.okta.oidc.net.response.IntrospectInfo in project okta-oidc-android by okta.

the class SessionClientImplTest method introspectTokenFailure.

@Test
public void introspectTokenFailure() throws InterruptedException {
    mEndPoint.enqueueReturnInvalidClient();
    final CountDownLatch latch = new CountDownLatch(1);
    MockRequestCallback<IntrospectInfo, AuthorizationException> cb = new MockRequestCallback<>(latch);
    mSessionClient.introspectToken(ACCESS_TOKEN, TokenTypeHint.ACCESS_TOKEN, cb);
    latch.await();
    assertNull(cb.getResult());
    assertNotNull(cb.getException());
}
Also used : MockRequestCallback(com.okta.oidc.util.MockRequestCallback) AuthorizationException(com.okta.oidc.util.AuthorizationException) CountDownLatch(java.util.concurrent.CountDownLatch) IntrospectInfo(com.okta.oidc.net.response.IntrospectInfo) Test(org.junit.Test)

Example 8 with IntrospectInfo

use of com.okta.oidc.net.response.IntrospectInfo 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

IntrospectInfo (com.okta.oidc.net.response.IntrospectInfo)8 AuthorizationException (com.okta.oidc.util.AuthorizationException)5 Test (org.junit.Test)5 OIDCConfig (com.okta.oidc.OIDCConfig)2 Tokens (com.okta.oidc.Tokens)2 IntrospectRequest (com.okta.oidc.net.request.IntrospectRequest)2 DefaultEncryptionManager (com.okta.oidc.storage.security.DefaultEncryptionManager)2 MockRequestCallback (com.okta.oidc.util.MockRequestCallback)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 Fragment (androidx.fragment.app.Fragment)1 FragmentTransaction (androidx.fragment.app.FragmentTransaction)1 AuthenticationPayload (com.okta.oidc.AuthenticationPayload)1 Okta (com.okta.oidc.Okta)1 SessionClient (com.okta.oidc.clients.sessions.SessionClient)1 WebAuthClient (com.okta.oidc.clients.web.WebAuthClient)1 SharedPreferenceStorage (com.okta.oidc.storage.SharedPreferenceStorage)1 GuardedEncryptionManager (com.okta.oidc.storage.security.GuardedEncryptionManager)1 IOException (java.io.IOException)1 GeneralSecurityException (java.security.GeneralSecurityException)1