Search in sources :

Example 1 with OIDCConfig

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

the class HttpClientImplTest method setUp.

@Before
public void setUp() throws Exception {
    mEndPoint = new MockEndPoint();
    String url = mEndPoint.getUrl();
    OIDCConfig config = TestValues.getConfigWithUrl(url);
    ProviderConfiguration providerConfiguration = TestValues.getProviderConfiguration(url);
    TokenResponse tokenResponse = new Gson().fromJson(JsonStrings.TOKEN_RESPONSE, TokenResponse.class);
    mHttpClient = new HttpClientImpl();
    mRequest = HttpRequestBuilder.newAuthorizedRequest().uri(Uri.parse(mEndPoint.getUrl())).httpRequestMethod(ConnectionParameters.RequestMethod.POST).config(config).providerConfiguration(providerConfiguration).tokenResponse(tokenResponse).createRequest();
}
Also used : TokenResponse(com.okta.oidc.net.response.TokenResponse) MockEndPoint(com.okta.oidc.util.MockEndPoint) OIDCConfig(com.okta.oidc.OIDCConfig) Gson(com.google.gson.Gson) ProviderConfiguration(com.okta.oidc.net.request.ProviderConfiguration) Before(org.junit.Before)

Example 2 with OIDCConfig

use of com.okta.oidc.OIDCConfig 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 3 with OIDCConfig

use of com.okta.oidc.OIDCConfig 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 4 with OIDCConfig

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

Example 5 with OIDCConfig

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

the class SyncSessionClientImplTest method userProfileRequestOAuth2.

@Test
public void userProfileRequestOAuth2() throws AuthorizationException, OktaRepository.EncryptionException {
    mExpectedEx.expect(AuthorizationException.class);
    // create sessionclient from oauth2 resource
    OIDCConfig oauth2Config = TestValues.getConfigWithUrl(mEndPoint.getUrl() + "/oauth2/default/");
    SyncWebAuthClient syncWebAuthClient = new Okta.SyncWebAuthBuilder().withConfig(oauth2Config).withOktaHttpClient(mHttpClient).withContext(mContext).withStorage(new SharedPreferenceStorage(mContext, "oauth2prefs")).withEncryptionManager(new EncryptionManagerStub()).create();
    SyncSessionClientImpl sessionClient = (SyncSessionClientImpl) syncWebAuthClient.getSessionClient();
    AuthorizedRequest request = sessionClient.userProfileRequest(mOktaState.getProviderConfiguration(), mOktaState.getTokenResponse());
    request.executeRequest(mHttpClient);
}
Also used : SharedPreferenceStorage(com.okta.oidc.storage.SharedPreferenceStorage) AuthorizedRequest(com.okta.oidc.net.request.AuthorizedRequest) OIDCConfig(com.okta.oidc.OIDCConfig) EncryptionManagerStub(com.okta.oidc.util.EncryptionManagerStub) SyncWebAuthClient(com.okta.oidc.clients.web.SyncWebAuthClient) Test(org.junit.Test)

Aggregations

OIDCConfig (com.okta.oidc.OIDCConfig)7 MockEndPoint (com.okta.oidc.util.MockEndPoint)6 Before (org.junit.Before)6 HttpClientFactory (com.okta.oidc.util.HttpClientFactory)5 Gson (com.google.gson.Gson)2 TokenResponse (com.okta.oidc.net.response.TokenResponse)2 SyncWebAuthClient (com.okta.oidc.clients.web.SyncWebAuthClient)1 AuthorizedRequest (com.okta.oidc.net.request.AuthorizedRequest)1 ProviderConfiguration (com.okta.oidc.net.request.ProviderConfiguration)1 SharedPreferenceStorage (com.okta.oidc.storage.SharedPreferenceStorage)1 EncryptionManagerStub (com.okta.oidc.util.EncryptionManagerStub)1 Test (org.junit.Test)1