use of nl.nn.adapterframework.http.authentication.HttpAuthenticationException in project iaf by ibissource.
the class OAuthAccessTokenManagerTest method testRetrieveAccessTokenWrongCredentials.
@Test
public void testRetrieveAccessTokenWrongCredentials() throws Exception {
String tokenEndpoint = TOKENENDPOINT;
String scope = "email";
String clientId = clientClientId;
String clientSecret = "xxx";
CredentialFactory client_cf = new CredentialFactory(null, clientId, clientSecret);
OAuthAccessTokenManager accessTokenManager = new OAuthAccessTokenManager(tokenEndpoint, scope, client_cf, true, httpSender);
HttpAuthenticationException exception = assertThrows(HttpAuthenticationException.class, () -> accessTokenManager.getAccessToken(null));
assertThat(exception.getMessage(), containsString("unauthorized_client"));
}
use of nl.nn.adapterframework.http.authentication.HttpAuthenticationException in project iaf by ibissource.
the class OAuthAccessTokenManagerTest method testRetrieveAccessTokenWrongTokenEndpoint.
@Test
public void testRetrieveAccessTokenWrongTokenEndpoint() throws Exception {
String tokenEndpoint = TOKENENDPOINT + "x";
String scope = "email";
String clientId = clientClientId;
String clientSecret = clientClientSecret;
CredentialFactory client_cf = new CredentialFactory(null, clientId, clientSecret);
OAuthAccessTokenManager accessTokenManager = new OAuthAccessTokenManager(tokenEndpoint, scope, client_cf, true, httpSender);
HttpAuthenticationException exception = assertThrows(HttpAuthenticationException.class, () -> accessTokenManager.getAccessToken(null));
assertThat(exception.getMessage(), containsString("404"));
}
Aggregations