use of com.okta.oidc.net.request.ConfigurationRequest in project okta-oidc-android by okta.
the class SyncWebAuthClientTest method configurationRequestFailure.
@Test
public void configurationRequestFailure() throws AuthorizationException, InterruptedException {
mExpectedEx.expect(AuthorizationException.class);
mEndPoint.enqueueConfigurationFailure();
ConfigurationRequest request = mSyncWebAuth.configurationRequest();
ProviderConfiguration configuration = request.executeRequest(mHttpClient);
RecordedRequest recordedRequest = mEndPoint.takeRequest();
assertThat(recordedRequest.getPath(), equalTo("//.well-known/openid-configuration?client_id=CLIENT_ID"));
assertNull(configuration);
}
use of com.okta.oidc.net.request.ConfigurationRequest in project okta-oidc-android by okta.
the class SyncWebAuthClientTest method configurationRequest.
@Test
public void configurationRequest() throws AuthorizationException, InterruptedException {
mEndPoint.enqueueConfigurationSuccess();
ConfigurationRequest request = mSyncWebAuth.configurationRequest();
ProviderConfiguration configuration = request.executeRequest(mHttpClient);
RecordedRequest recordedRequest = mEndPoint.takeRequest();
assertThat(recordedRequest.getPath(), equalTo("//.well-known/openid-configuration?client_id=CLIENT_ID"));
assertNotNull(configuration);
assertEquals(mGson.fromJson(PROVIDER_CONFIG, ProviderConfiguration.class).persist(), configuration.persist());
}
use of com.okta.oidc.net.request.ConfigurationRequest in project okta-oidc-android by okta.
the class AuthAPI method obtainNewConfiguration.
protected ProviderConfiguration obtainNewConfiguration() throws AuthorizationException {
try {
ProviderConfiguration config = mOktaState.getProviderConfiguration();
Uri discoveryUri = mOidcConfig.getDiscoveryUri();
if (discoveryUri != null) {
if (config == null || !discoveryUri.toString().contains(config.issuer)) {
mOktaState.setCurrentState(State.OBTAIN_CONFIGURATION);
ConfigurationRequest request = configurationRequest();
mCurrentRequest.set(new WeakReference<>(request));
config = request.executeRequest(mHttpClient);
mOktaState.save(config);
}
} else {
config = new ProviderConfiguration(mOidcConfig.getCustomConfiguration());
mOktaState.save(config);
}
return config;
} catch (OktaRepository.EncryptionException e) {
throw AuthorizationException.EncryptionErrors.byEncryptionException(e);
}
}
Aggregations