Search in sources :

Example 6 with HttpClientFactory

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

the class TokenRequestTest method setUp.

@Before
public void setUp() throws Exception {
    mEndPoint = new MockEndPoint();
    String url = mEndPoint.getUrl();
    mConfig = TestValues.getConfigWithUrl(url);
    mProviderConfig = TestValues.getProviderConfiguration(url);
    mRequest = TestValues.getTokenRequest(mConfig, getAuthorizeRequest(mConfig, CodeVerifierUtil.generateRandomCodeVerifier()), getAuthorizeResponse(CUSTOM_STATE, CUSTOM_CODE), mProviderConfig);
    mClientFactory = new HttpClientFactory();
    mClientFactory.setClientType(mClientType);
    mHttpClient = mClientFactory.build();
}
Also used : MockEndPoint(com.okta.oidc.util.MockEndPoint) HttpClientFactory(com.okta.oidc.util.HttpClientFactory) Before(org.junit.Before)

Example 7 with HttpClientFactory

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

the class SyncAuthClientTest method setUp.

@Before
public void setUp() throws Exception {
    mContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
    mEndPoint = new MockEndPoint();
    String url = mEndPoint.getUrl();
    mConfig = TestValues.getConfigWithUrl(url);
    mStorage = new SharedPreferenceStorage(mContext);
    mClientFactory = new HttpClientFactory();
    mClientFactory.setClientType(mClientType);
    mHttpClient = mClientFactory.build();
    mProviderConfig = TestValues.getProviderConfiguration(url);
    SyncAuthClient okta = new Okta.SyncAuthBuilder().withConfig(mConfig).withOktaHttpClient(mHttpClient).withContext(mContext).withStorage(mStorage).withEncryptionManager(new EncryptionManagerStub()).create();
    mSyncNativeAuth = (SyncAuthClientImpl) okta;
    mCallbackExecutor = Executors.newSingleThreadExecutor();
    mAuthClient = new Okta.AuthBuilder().withConfig(mConfig).withOktaHttpClient(mHttpClient).withContext(mContext).withStorage(mStorage).withCallbackExecutor(mCallbackExecutor).withEncryptionManager(new EncryptionManagerStub()).create();
    mOktaState = mSyncNativeAuth.getOktaState();
    mOktaState.save(mProviderConfig);
    mOktaState.save(TokenResponse.RESTORE.restore(TOKEN_RESPONSE));
}
Also used : SharedPreferenceStorage(com.okta.oidc.storage.SharedPreferenceStorage) MockEndPoint(com.okta.oidc.util.MockEndPoint) EncryptionManagerStub(com.okta.oidc.util.EncryptionManagerStub) HttpClientFactory(com.okta.oidc.util.HttpClientFactory) Before(org.junit.Before)

Example 8 with HttpClientFactory

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

the class SyncSessionClientImplTest method setUp.

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

Example 9 with HttpClientFactory

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

the class BaseRequestTest method setUp.

@Before
public void setUp() throws Exception {
    mEndPoint = new MockEndPoint();
    mRequest = new BaseRequest<String, AuthorizationException>() {

        @Override
        public String executeRequest(OktaHttpClient client) throws AuthorizationException {
            return null;
        }
    };
    mClientFactory = new HttpClientFactory();
    mClientFactory.setClientType(mClientType);
    mHttpClient = mClientFactory.build();
}
Also used : OktaHttpClient(com.okta.oidc.net.OktaHttpClient) AuthorizationException(com.okta.oidc.util.AuthorizationException) MockEndPoint(com.okta.oidc.util.MockEndPoint) HttpClientFactory(com.okta.oidc.util.HttpClientFactory) Before(org.junit.Before)

Example 10 with HttpClientFactory

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

the class NativeAuthorizeRequestTest 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.getNativeLogInRequest(config, SESSION_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