@Test public void shouldFinishOAuth2Acquisition() { final OAuth2ConnectionFactory<?> oauth2 = mock(OAuth2ConnectionFactory.class); final OAuth2Applicator applicator = new OAuth2Applicator(properties); applicator.setAccessTokenProperty("accessTokenProperty"); applicator.setClientIdProperty("clientIdProperty"); applicator.setClientSecretProperty("clientSecretProperty"); applicator.setRefreshTokenProperty("refreshTokenProperty"); when(locator.providerWithId("providerId")) .thenReturn(new OAuth2CredentialProvider<>("providerId", oauth2, applicator, Collections.emptyMap())); final OAuth2Operations operations = mock(OAuth2Operations.class); when(oauth2.getOAuthOperations()).thenReturn(operations); final AccessGrant accessGrant = new AccessGrant("accessToken", "scope", "refreshToken", 1L); when(operations.exchangeForAccess("code", "https: .thenReturn(accessGrant); final CredentialFlowState flowState = new OAuth2CredentialFlowState.Builder().providerId("providerId") .returnUrl(URI.create("/ui#state")).code("code").state("state").build(); final CredentialFlowState finalFlowState = credentials.finishAcquisition(flowState, URI.create("https: assertThat(finalFlowState) .isEqualTo(new OAuth2CredentialFlowState.Builder().createFrom(flowState).accessGrant(accessGrant).build()); }
public CredentialFlowState finishAcquisition(final CredentialFlowState flowState, final URI baseUrl) { final CredentialProvider credentialProvider = providerFrom(flowState); return credentialProvider.finish(flowState, baseUrl); }
Credentials { public CredentialFlowState finishAcquisition(final CredentialFlowState flowState, final URI baseUrl) { final CredentialProvider credentialProvider = providerFrom(flowState); return credentialProvider.finish(flowState, baseUrl); } }
Credentials { public CredentialFlowState finishAcquisition(final CredentialFlowState flowState, final URI baseUrl) { final CredentialProvider credentialProvider = providerFrom(flowState); return credentialProvider.finish(flowState, baseUrl); } @Autowired  Credentials(final CredentialProviderLocator credentialProviderLocator, final EncryptionComponent encryptionComponent,
        final DataManager dataManager); }
Credentials { public CredentialFlowState finishAcquisition(final CredentialFlowState flowState, final URI baseUrl) { final CredentialProvider credentialProvider = providerFrom(flowState); return credentialProvider.finish(flowState, baseUrl); } @Autowired  Credentials(final CredentialProviderLocator credentialProviderLocator, final EncryptionComponent encryptionComponent,
        final DataManager dataManager); AcquisitionFlow acquire(final String providerId, final URI baseUrl, final URI returnUrl); AcquisitionMethod acquisitionMethodFor(final String providerId); Connection apply(final Connection updatedConnection, final CredentialFlowState flowState); CredentialFlowState finishAcquisition(final CredentialFlowState flowState, final URI baseUrl); }
Credentials { public CredentialFlowState finishAcquisition(final CredentialFlowState flowState, final URI baseUrl) { final CredentialProvider credentialProvider = providerFrom(flowState); return credentialProvider.finish(flowState, baseUrl); } @Autowired  Credentials(final CredentialProviderLocator credentialProviderLocator, final EncryptionComponent encryptionComponent,
        final DataManager dataManager); AcquisitionFlow acquire(final String providerId, final URI baseUrl, final URI returnUrl); AcquisitionMethod acquisitionMethodFor(final String providerId); Connection apply(final Connection updatedConnection, final CredentialFlowState flowState); CredentialFlowState finishAcquisition(final CredentialFlowState flowState, final URI baseUrl); static final String ACCESS_TOKEN_TAG; static final String ACCESS_TOKEN_URL_TAG; static final String AUTHENTICATION_TYPE_TAG; static final String AUTHENTICATION_URL_TAG; static final String AUTHORIZATION_URL_TAG; static final String AUTHORIZE_USING_PARAMETERS_TAG; static final String CLIENT_ID_TAG; static final String CLIENT_SECRET_TAG; static final String SCOPE_TAG; static final String TOKEN_STRATEGY_TAG; static final String ADDITIONAL_QUERY_PARAMETERS_TAG; }