use of com.auth0.client.LoggingOptions in project auth0-java by auth0.
the class ManagementAPITest method shouldConfigureBodyLoggingFromOptions.
@Test
public void shouldConfigureBodyLoggingFromOptions() {
LoggingOptions loggingOptions = new LoggingOptions(LoggingOptions.LogLevel.BODY);
Set<String> headersToRedact = new HashSet<>();
headersToRedact.add("Authorization");
headersToRedact.add("Cookie");
loggingOptions.setHeadersToRedact(headersToRedact);
HttpOptions options = new HttpOptions();
options.setLoggingOptions(loggingOptions);
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN, 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.BODY));
}
}
}
use of com.auth0.client.LoggingOptions in project auth0-java by auth0.
the class ManagementAPITest method shouldConfigureNoneLoggingFromOptions.
@Test
public void shouldConfigureNoneLoggingFromOptions() {
LoggingOptions loggingOptions = new LoggingOptions(LoggingOptions.LogLevel.NONE);
HttpOptions options = new HttpOptions();
options.setLoggingOptions(loggingOptions);
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN, 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 shouldConfigureBodyLoggingFromOptions.
@Test
public void shouldConfigureBodyLoggingFromOptions() {
LoggingOptions loggingOptions = new LoggingOptions(LoggingOptions.LogLevel.BODY);
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.BODY));
}
}
}
use of com.auth0.client.LoggingOptions in project auth0-java by auth0.
the class ManagementAPITest 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);
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN, 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.LoggingOptions in project auth0-java by auth0.
the class ManagementAPITest method shouldConfigureBasicLoggingFromOptions.
@Test
public void shouldConfigureBasicLoggingFromOptions() {
LoggingOptions loggingOptions = new LoggingOptions(LoggingOptions.LogLevel.BASIC);
HttpOptions options = new HttpOptions();
options.setLoggingOptions(loggingOptions);
ManagementAPI api = new ManagementAPI(DOMAIN, API_TOKEN, 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));
}
}
}
Aggregations