Search in sources :

Example 1 with CannotDecodeOAuth2State

use of bio.terra.externalcreds.models.CannotDecodeOAuth2State in project terra-external-credentials-manager by DataBiosphere.

the class ProviderService method validateOAuth2State.

private void validateOAuth2State(String providerName, String userId, String encodedState) {
    try {
        OAuth2State oAuth2State = OAuth2State.decode(objectMapper, encodedState);
        if (!providerName.equals(oAuth2State.getProvider())) {
            throw new InvalidOAuth2State();
        }
        linkedAccountService.validateAndDeleteOAuth2State(userId, oAuth2State);
    } catch (CannotDecodeOAuth2State e) {
        throw new InvalidOAuth2State(e);
    }
}
Also used : CannotDecodeOAuth2State(bio.terra.externalcreds.models.CannotDecodeOAuth2State) OAuth2State(bio.terra.externalcreds.models.OAuth2State) CannotDecodeOAuth2State(bio.terra.externalcreds.models.CannotDecodeOAuth2State)

Aggregations

CannotDecodeOAuth2State (bio.terra.externalcreds.models.CannotDecodeOAuth2State)1 OAuth2State (bio.terra.externalcreds.models.OAuth2State)1