Search in sources :

Example 1 with NoAuthenticator

use of com.github.tomakehurst.wiremock.security.NoAuthenticator in project wiremock by wiremock.

the class CommandLineOptions method toString.

@Override
public String toString() {
    ImmutableMap.Builder<String, Object> builder = ImmutableMap.builder();
    if (actualHttpPort != null) {
        builder.put(PORT, actualHttpPort);
    }
    if (actualHttpsPort != null) {
        builder.put(HTTPS_PORT, actualHttpsPort);
    }
    if (httpsSettings().enabled()) {
        builder.put(HTTPS_KEYSTORE, nullToString(httpsSettings().keyStorePath()));
    }
    if (!(proxyVia() == NO_PROXY)) {
        builder.put(PROXY_VIA, proxyVia());
    }
    if (proxyUrl() != null) {
        builder.put(PROXY_ALL, nullToString(proxyUrl())).put(PRESERVE_HOST_HEADER, shouldPreserveHostHeader());
    }
    BrowserProxySettings browserProxySettings = browserProxySettings();
    builder.put(ENABLE_BROWSER_PROXYING, browserProxySettings.enabled());
    if (browserProxySettings.enabled()) {
        KeyStoreSettings keyStoreSettings = browserProxySettings.caKeyStore();
        builder.put(TRUST_ALL_PROXY_TARGETS, browserProxySettings.trustAllProxyTargets());
        List<String> trustedProxyTargets = browserProxySettings.trustedProxyTargets();
        if (!trustedProxyTargets.isEmpty()) {
            builder.put(TRUST_PROXY_TARGET, Joiner.on(", ").join(trustedProxyTargets));
        }
        builder.put(HTTPS_CA_KEYSTORE, keyStoreSettings.path());
        builder.put(HTTPS_CA_KEYSTORE_TYPE, keyStoreSettings.type());
    }
    builder.put(DISABLE_BANNER, bannerDisabled());
    if (recordMappingsEnabled()) {
        builder.put(RECORD_MAPPINGS, recordMappingsEnabled()).put(MATCH_HEADERS, matchingHeaders());
    }
    builder.put(DISABLE_REQUEST_JOURNAL, requestJournalDisabled()).put(VERBOSE, verboseLoggingEnabled());
    if (jettySettings().getAcceptQueueSize().isPresent()) {
        builder.put(JETTY_ACCEPT_QUEUE_SIZE, jettySettings().getAcceptQueueSize().get());
    }
    if (jettySettings().getAcceptors().isPresent()) {
        builder.put(JETTY_ACCEPTOR_THREAD_COUNT, jettySettings().getAcceptors().get());
    }
    if (jettySettings().getRequestHeaderSize().isPresent()) {
        builder.put(JETTY_HEADER_BUFFER_SIZE, jettySettings().getRequestHeaderSize().get());
    }
    if (!(getAdminAuthenticator() instanceof NoAuthenticator)) {
        builder.put(ADMIN_API_BASIC_AUTH, "enabled");
    }
    if (getHttpsRequiredForAdminApi()) {
        builder.put(ADMIN_API_REQUIRE_HTTPS, "true");
    }
    StringBuilder sb = new StringBuilder();
    for (Map.Entry<String, Object> param : builder.build().entrySet()) {
        int paddingLength = 29 - param.getKey().length();
        sb.append(param.getKey()).append(":").append(Strings.repeat(" ", paddingLength)).append(nullToString(param.getValue())).append("\n");
    }
    return sb.toString();
}
Also used : NoAuthenticator(com.github.tomakehurst.wiremock.security.NoAuthenticator) KeyStoreSettings(com.github.tomakehurst.wiremock.common.ssl.KeyStoreSettings) Map(java.util.Map)

Example 2 with NoAuthenticator

use of com.github.tomakehurst.wiremock.security.NoAuthenticator in project wiremock by wiremock.

the class JettyHttpServerTest method init.

@BeforeEach
public void init() {
    Admin admin = Mockito.mock(Admin.class);
    adminRequestHandler = new AdminRequestHandler(AdminRoutes.defaults(), admin, new BasicResponseRenderer(), new NoAuthenticator(), false, Collections.<RequestFilter>emptyList());
    stubRequestHandler = new StubRequestHandler(Mockito.mock(StubServer.class), Mockito.mock(ResponseRenderer.class), admin, Collections.<String, PostServeAction>emptyMap(), Mockito.mock(RequestJournal.class), Collections.<RequestFilter>emptyList(), false);
}
Also used : NoAuthenticator(com.github.tomakehurst.wiremock.security.NoAuthenticator) StubRequestHandler(com.github.tomakehurst.wiremock.http.StubRequestHandler) PostServeAction(com.github.tomakehurst.wiremock.extension.PostServeAction) AdminRequestHandler(com.github.tomakehurst.wiremock.http.AdminRequestHandler) BasicResponseRenderer(com.github.tomakehurst.wiremock.http.BasicResponseRenderer) Admin(com.github.tomakehurst.wiremock.core.Admin) RequestFilter(com.github.tomakehurst.wiremock.extension.requestfilter.RequestFilter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with NoAuthenticator

use of com.github.tomakehurst.wiremock.security.NoAuthenticator in project wiremock by wiremock.

the class AdminRequestHandlerTest method init.

@BeforeEach
public void init() {
    httpResponder = new MockHttpResponder();
    handler = new AdminRequestHandler(AdminRoutes.defaults(), admin, new BasicResponseRenderer(), new NoAuthenticator(), false, Collections.<RequestFilter>emptyList());
}
Also used : NoAuthenticator(com.github.tomakehurst.wiremock.security.NoAuthenticator) AdminRequestHandler(com.github.tomakehurst.wiremock.http.AdminRequestHandler) BasicResponseRenderer(com.github.tomakehurst.wiremock.http.BasicResponseRenderer) MockHttpResponder(com.github.tomakehurst.wiremock.testsupport.MockHttpResponder) RequestFilter(com.github.tomakehurst.wiremock.extension.requestfilter.RequestFilter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

NoAuthenticator (com.github.tomakehurst.wiremock.security.NoAuthenticator)3 RequestFilter (com.github.tomakehurst.wiremock.extension.requestfilter.RequestFilter)2 AdminRequestHandler (com.github.tomakehurst.wiremock.http.AdminRequestHandler)2 BasicResponseRenderer (com.github.tomakehurst.wiremock.http.BasicResponseRenderer)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 KeyStoreSettings (com.github.tomakehurst.wiremock.common.ssl.KeyStoreSettings)1 Admin (com.github.tomakehurst.wiremock.core.Admin)1 PostServeAction (com.github.tomakehurst.wiremock.extension.PostServeAction)1 StubRequestHandler (com.github.tomakehurst.wiremock.http.StubRequestHandler)1 MockHttpResponder (com.github.tomakehurst.wiremock.testsupport.MockHttpResponder)1 Map (java.util.Map)1