use of com.auth0.client.HttpOptions in project auth0-java by auth0.
the class AuthAPITest method shouldUseZeroIfNegativeTimoutConfigured.
@Test
public void shouldUseZeroIfNegativeTimoutConfigured() {
HttpOptions options = new HttpOptions();
options.setConnectTimeout(-1);
options.setReadTimeout(-10);
AuthAPI api = new AuthAPI(DOMAIN, CLIENT_ID, CLIENT_SECRET, options);
assertThat(api.getClient().connectTimeoutMillis(), is(0));
assertThat(api.getClient().readTimeoutMillis(), is(0));
}
use of com.auth0.client.HttpOptions in project auth0-java by auth0.
the class AuthAPITest method shouldConfigureHeaderLoggingFromOptions.
@Test
public void shouldConfigureHeaderLoggingFromOptions() {
LoggingOptions loggingOptions = new LoggingOptions(LoggingOptions.LogLevel.HEADERS);
Set<String> headersToRedact = new HashSet<>();
headersToRedact.add("Authorization");
headersToRedact.add("Cookie");
loggingOptions.setHeadersToRedact(headersToRedact);
HttpOptions options = new HttpOptions();
options.setLoggingOptions(loggingOptions);
AuthAPI api = new AuthAPI(DOMAIN, CLIENT_ID, CLIENT_SECRET, options);
assertThat(api.getClient().interceptors(), hasItem(isA(HttpLoggingInterceptor.class)));
for (Interceptor i : api.getClient().interceptors()) {
if (i instanceof HttpLoggingInterceptor) {
HttpLoggingInterceptor logging = (HttpLoggingInterceptor) i;
assertThat(logging.getLevel(), is(Level.HEADERS));
}
}
}
use of com.auth0.client.HttpOptions in project auth0-java-mvc-common by auth0.
the class AuthenticationControllerTest method shouldCreateAuthAPIClientWithoutCustomHttpOptions.
@Test
public void shouldCreateAuthAPIClientWithoutCustomHttpOptions() {
ArgumentCaptor<HttpOptions> captor = ArgumentCaptor.forClass(HttpOptions.class);
AuthenticationController.Builder spy = spy(AuthenticationController.newBuilder("domain", "clientId", "clientSecret"));
spy.build();
verify(spy).createAPIClient(eq("domain"), eq("clientId"), eq("clientSecret"), captor.capture());
HttpOptions actual = captor.getValue();
assertThat(actual, is(nullValue()));
}
Aggregations