use of com.okta.oidc.net.request.ProviderConfiguration in project okta-oidc-android by okta.
the class SyncSessionClientImpl method migrateTo.
@Override
public void migrateTo(EncryptionManager manager) throws AuthorizationException {
try {
final ProviderConfiguration providerConfiguration = mOktaState.getProviderConfiguration();
final TokenResponse tokenResponse = mOktaState.getTokenResponse();
final WebRequest authorizedRequest = mOktaState.getAuthorizeRequest();
clear();
mOktaState.setEncryptionManager(manager);
mOktaState.save(providerConfiguration);
mOktaState.save(tokenResponse);
mOktaState.save(authorizedRequest);
} catch (OktaRepository.EncryptionException e) {
throw AuthorizationException.EncryptionErrors.byEncryptionException(e);
}
}
use of com.okta.oidc.net.request.ProviderConfiguration in project okta-oidc-android by okta.
the class SyncWebAuthClientImpl method signIn.
@Override
@WorkerThread
public Result signIn(@NonNull final Activity activity, @Nullable AuthenticationPayload payload) {
mCancel.set(false);
try {
if (!isRedirectUrisRegistered(mOidcConfig.getRedirectUri(), activity)) {
String errorDescription = "No uri registered to handle redirect " + "or multiple applications registered";
Log.e(TAG, errorDescription);
throw new AuthorizationException(TYPE_OAUTH_REGISTRATION_ERROR, INVALID_REDIRECT_URI.code, INVALID_REDIRECT_URI.error, errorDescription, null, null);
}
ProviderConfiguration configuration = obtainNewConfiguration();
checkIfCanceled();
WebRequest request = new AuthorizeRequest.Builder().config(mOidcConfig).providerConfiguration(configuration).authenticationPayload(payload).create();
mOktaState.save(request);
mOktaState.setCurrentState(State.SIGN_IN_REQUEST);
StateResult authResult = startSignIn(activity, request);
return processSignInResult(authResult);
} catch (AuthorizationException e) {
return Result.error(e);
} catch (IOException | InterruptedException e) {
return Result.cancel();
} catch (OktaRepository.EncryptionException e) {
return Result.error(EncryptionErrors.byEncryptionException(e));
} finally {
resetCurrentState();
}
}
use of com.okta.oidc.net.request.ProviderConfiguration in project okta-oidc-android by okta.
the class OktaStateTest method getProviderConfiguration.
@Test
public void getProviderConfiguration() throws OktaRepository.EncryptionException {
ProviderConfiguration providerConfiguration = TestValues.getProviderConfiguration(CUSTOM_URL);
mOktaState.save(providerConfiguration);
ProviderConfiguration expected = mOktaState.getProviderConfiguration();
assertNotNull(expected);
assertEquals(providerConfiguration.persist(), expected.persist());
}
use of com.okta.oidc.net.request.ProviderConfiguration in project okta-oidc-android by okta.
the class OktaStateTest method validateDelete.
@Test
public void validateDelete() throws OktaRepository.EncryptionException {
TokenResponse tokenResponse = TestValues.getTokenResponse();
ProviderConfiguration providerConfiguration = TestValues.getProviderConfiguration(CUSTOM_URL);
mOktaState.save(tokenResponse);
mOktaState.save(providerConfiguration);
mOktaState.delete(tokenResponse);
assertNull(mOktaState.getTokenResponse());
assertNotNull(mOktaState.getProviderConfiguration());
}
use of com.okta.oidc.net.request.ProviderConfiguration in project okta-oidc-android by okta.
the class TestValues method getOAuth2ProviderConfiguration.
public static ProviderConfiguration getOAuth2ProviderConfiguration(String url) {
ProviderConfiguration configuration = getProviderConfiguration(url);
configuration.userinfo_endpoint = null;
return configuration;
}
Aggregations