Search in sources :

Example 1 with HttpClientFactory

use of com.okta.oidc.util.HttpClientFactory in project okta-oidc-android by okta.

the class SyncWebAuthClientTest method setUp.

@Before
public void setUp() throws Exception {
    mContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    mEndPoint = new MockEndPoint();
    String url = mEndPoint.getUrl();
    mClientFactory = new HttpClientFactory();
    mClientFactory.setClientType(mClientType);
    mHttpClient = mClientFactory.build();
    mConfig = TestValues.getConfigWithUrl(url);
    mStorage = new SharedPreferenceStorage(mContext);
    mGson = new Gson();
    mProviderConfig = TestValues.getProviderConfiguration(url);
    mTokenResponse = TokenResponse.RESTORE.restore(TOKEN_RESPONSE);
    SyncWebAuthClient okta = new Okta.SyncWebAuthBuilder().withConfig(mConfig).withOktaHttpClient(mHttpClient).withContext(mContext).withStorage(mStorage).withEncryptionManager(new EncryptionManagerStub()).create();
    mSyncWebAuth = (SyncWebAuthClientImpl) okta;
    mOktaState = mSyncWebAuth.getOktaState();
    mOktaState.save(mProviderConfig);
}
Also used : SharedPreferenceStorage(com.okta.oidc.storage.SharedPreferenceStorage) MockEndPoint(com.okta.oidc.util.MockEndPoint) Gson(com.google.gson.Gson) EncryptionManagerStub(com.okta.oidc.util.EncryptionManagerStub) HttpClientFactory(com.okta.oidc.util.HttpClientFactory) Before(org.junit.Before)

Example 2 with HttpClientFactory

use of com.okta.oidc.util.HttpClientFactory 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)

Example 3 with HttpClientFactory

use of com.okta.oidc.util.HttpClientFactory in project okta-oidc-android by okta.

the class ConfigurationRequestTest method setUp.

@Before
public void setUp() throws Exception {
    mEndPoint = new MockEndPoint();
    String url = mEndPoint.getUrl();
    OIDCConfig config = TestValues.getConfigWithUrl(url);
    mRequest = HttpRequestBuilder.newConfigurationRequest().config(config).createRequest();
    mClientFactory = new HttpClientFactory();
    mClientFactory.setClientType(mClientType);
    mHttpClient = mClientFactory.build();
    OIDCConfig configOAuth2 = TestValues.getConfigWithUrl(url + "/oauth2/default/" + WELL_KNOWN_OAUTH);
    mRequestOAuth2 = HttpRequestBuilder.newConfigurationRequest().config(configOAuth2).createRequest();
    mCallbackExecutor = Executors.newSingleThreadExecutor();
}
Also used : MockEndPoint(com.okta.oidc.util.MockEndPoint) OIDCConfig(com.okta.oidc.OIDCConfig) HttpClientFactory(com.okta.oidc.util.HttpClientFactory) Before(org.junit.Before)

Example 4 with HttpClientFactory

use of com.okta.oidc.util.HttpClientFactory in project okta-oidc-android by okta.

the class IntrospectRequestTest method setUp.

@Before
public void setUp() throws Exception {
    mEndPoint = new MockEndPoint();
    String url = mEndPoint.getUrl();
    OIDCConfig config = TestValues.getConfigWithUrl(url);
    mProviderConfig = getProviderConfiguration(url);
    mRequest = TestValues.getIntrospectTokenRequest(config, ACCESS_TOKEN, TokenTypeHint.ACCESS_TOKEN, mProviderConfig);
    mClientFactory = new HttpClientFactory();
    mClientFactory.setClientType(mClientType);
    mHttpClient = mClientFactory.build();
}
Also used : MockEndPoint(com.okta.oidc.util.MockEndPoint) OIDCConfig(com.okta.oidc.OIDCConfig) HttpClientFactory(com.okta.oidc.util.HttpClientFactory) Before(org.junit.Before)

Example 5 with HttpClientFactory

use of com.okta.oidc.util.HttpClientFactory in project okta-oidc-android by okta.

the class RevokeTokenRequestTest method setUp.

@Before
public void setUp() throws Exception {
    mEndPoint = new MockEndPoint();
    String url = mEndPoint.getUrl();
    OIDCConfig config = TestValues.getConfigWithUrl(url);
    mProviderConfig = getProviderConfiguration(url);
    mRequest = TestValues.getRevokeTokenRequest(config, ACCESS_TOKEN, mProviderConfig);
    mClientFactory = new HttpClientFactory();
    mClientFactory.setClientType(mClientType);
    mHttpClient = mClientFactory.build();
}
Also used : MockEndPoint(com.okta.oidc.util.MockEndPoint) OIDCConfig(com.okta.oidc.OIDCConfig) HttpClientFactory(com.okta.oidc.util.HttpClientFactory) Before(org.junit.Before)

Aggregations

HttpClientFactory (com.okta.oidc.util.HttpClientFactory)12 MockEndPoint (com.okta.oidc.util.MockEndPoint)12 Before (org.junit.Before)12 OIDCConfig (com.okta.oidc.OIDCConfig)5 Gson (com.google.gson.Gson)4 SharedPreferenceStorage (com.okta.oidc.storage.SharedPreferenceStorage)4 EncryptionManagerStub (com.okta.oidc.util.EncryptionManagerStub)4 Okta (com.okta.oidc.Okta)1 OktaState (com.okta.oidc.OktaState)1 SyncWebAuthClient (com.okta.oidc.clients.web.SyncWebAuthClient)1 WebAuthClient (com.okta.oidc.clients.web.WebAuthClient)1 OktaHttpClient (com.okta.oidc.net.OktaHttpClient)1 TokenResponse (com.okta.oidc.net.response.TokenResponse)1 OktaRepository (com.okta.oidc.storage.OktaRepository)1 OktaStorage (com.okta.oidc.storage.OktaStorage)1 AuthorizationException (com.okta.oidc.util.AuthorizationException)1