Search in sources :

Example 1 with OktaState

use of com.okta.oidc.OktaState in project okta-oidc-android by okta.

the class SessionClientImplTest method setUp.

@Before
public void setUp() throws Exception {
    mContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    mEndPoint = new MockEndPoint();
    mGson = new Gson();
    mStorage = new SharedPreferenceStorage(mContext);
    String url = mEndPoint.getUrl();
    mClientFactory = new HttpClientFactory();
    mClientFactory.setClientType(mClientType);
    mConfig = TestValues.getConfigWithUrl(url);
    mProviderConfig = TestValues.getProviderConfiguration(url);
    mTokenResponse = TokenResponse.RESTORE.restore(TOKEN_RESPONSE);
    WebAuthClient okta = new Okta.WebAuthBuilder().withCallbackExecutor(mExecutor).withConfig(mConfig).withOktaHttpClient(mClientFactory.build()).withContext(mContext).withStorage(mStorage).withEncryptionManager(new EncryptionManagerStub()).create();
    mSessionClient = okta.getSessionClient();
    OktaState mOktaState = new OktaState(new OktaRepository(mStorage, mContext, new EncryptionManagerStub(), false, false));
    mOktaState.save(mTokenResponse);
    mOktaState.save(mProviderConfig);
}
Also used : SharedPreferenceStorage(com.okta.oidc.storage.SharedPreferenceStorage) OktaState(com.okta.oidc.OktaState) OktaRepository(com.okta.oidc.storage.OktaRepository) MockEndPoint(com.okta.oidc.util.MockEndPoint) Gson(com.google.gson.Gson) WebAuthClient(com.okta.oidc.clients.web.WebAuthClient) EncryptionManagerStub(com.okta.oidc.util.EncryptionManagerStub) Okta(com.okta.oidc.Okta) HttpClientFactory(com.okta.oidc.util.HttpClientFactory) Before(org.junit.Before)

Aggregations

Gson (com.google.gson.Gson)1 Okta (com.okta.oidc.Okta)1 OktaState (com.okta.oidc.OktaState)1 WebAuthClient (com.okta.oidc.clients.web.WebAuthClient)1 OktaRepository (com.okta.oidc.storage.OktaRepository)1 SharedPreferenceStorage (com.okta.oidc.storage.SharedPreferenceStorage)1 EncryptionManagerStub (com.okta.oidc.util.EncryptionManagerStub)1 HttpClientFactory (com.okta.oidc.util.HttpClientFactory)1 MockEndPoint (com.okta.oidc.util.MockEndPoint)1 Before (org.junit.Before)1