use of com.auth0.client.LoggingOptions in project auth0-java by auth0.
the class AuthAPITest method shouldConfigureBasicLoggingFromOptions.
@Test
public void shouldConfigureBasicLoggingFromOptions() {
LoggingOptions loggingOptions = new LoggingOptions(LoggingOptions.LogLevel.BASIC);
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.BASIC));
}
}
}
use of com.auth0.client.LoggingOptions in project auth0-java by auth0.
the class AuthAPITest method shouldConfigureNoneLoggingFromOptions.
@Test
public void shouldConfigureNoneLoggingFromOptions() {
LoggingOptions loggingOptions = new LoggingOptions(LoggingOptions.LogLevel.NONE);
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.NONE));
}
}
}
use of com.auth0.client.LoggingOptions 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));
}
}
}
Aggregations