final Object basicAuthProvider = config.getProperty(JettyClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION); if (basicAuthProvider != null && (basicAuthProvider instanceof BasicAuthentication)) { auth.addAuthentication((BasicAuthentication) basicAuthProvider);
@Override protected void doStop() throws Exception { decoderFactories.clear(); handlers.clear(); for (HttpDestination destination : destinations.values()) destination.close(); destinations.clear(); requestListeners.clear(); authenticationStore.clearAuthentications(); authenticationStore.clearAuthenticationResults(); super.doStop(); }
@Override public void onSuccess(Response response) { client.getAuthenticationStore().addAuthenticationResult(authenticationResult); } }
private void applyAuthentication(Request request, URI uri) { if (uri != null) { Authentication.Result result = getHttpClient().getAuthenticationStore().findAuthenticationResult(uri); if (result != null) result.apply(request); } }
for (WWWAuthenticate wwwAuthn : wwwAuthenticates) authentication = client.getAuthenticationStore().findAuthentication(wwwAuthn.type, uri, wwwAuthn.realm); if (authentication != null)
@Override protected void doStop() throws Exception { LOG.debug("Stopping {}", this); cookieStore.removeAll(); cookieStore = null; decoderFactories.clear(); handlers.clear(); for (HttpDestination destination : destinations.values()) destination.close(); destinations.clear(); conversations.clear(); requestListeners.clear(); authenticationStore.clearAuthentications(); authenticationStore.clearAuthenticationResults(); super.doStop(); LOG.info("Stopped {}", this); }
@Override public void onSuccess(Response response) { client.getAuthenticationStore().addAuthenticationResult(authnResult); } }).send(null);
Authentication.Result authnResult = client.getAuthenticationStore().findAuthenticationResult(request.getURI()); if (authnResult != null) authnResult.apply(request);
for (WWWAuthenticate wwwAuthn : wwwAuthenticates) authentication = client.getAuthenticationStore().findAuthentication(wwwAuthn.type, uri, wwwAuthn.realm); if (authentication != null)
@Override public IRequest setBasicAuthentication(String username, String password, String realm, boolean preemptive) { if (preemptive) { request.getHeaders().add("Authorization", "Basic " + Base64.getEncoder(). encodeToString((username + ":" + password).getBytes())); } else { AuthenticationStore auth = httpClient.getAuthenticationStore(); auth.addAuthentication(new BasicAuthentication(uri, realm, username, password)); } return this; }
@Override protected void doStop() throws Exception { LOG.debug("Stopping {}", this); cookieStore.removeAll(); cookieStore = null; decoderFactories.clear(); handlers.clear(); for (HttpDestination destination : destinations.values()) destination.close(); destinations.clear(); conversations.clear(); requestListeners.clear(); authenticationStore.clearAuthentications(); authenticationStore.clearAuthenticationResults(); super.doStop(); LOG.info("Stopped {}", this); }
@Override public void onSuccess(Response response) { client.getAuthenticationStore().addAuthenticationResult(authnResult); } }).send(null);
Authentication.Result authnResult = client.getAuthenticationStore().findAuthenticationResult(request.getURI()); if (authnResult != null) authnResult.apply(request);
authentication = client.getAuthenticationStore().findAuthentication(element.getType(), authURI, element.getRealm()); if (authentication != null)
protected void addBasicAuthentication(HttpClient httpClient, String url, String username) { String password = runtimeProperties.get(ClientConstants.ROP_SERVICE_PASSWORD_PROPERTY); String realm = runtimeProperties.get(ClientConstants.ROP_SERVICE_REALM_PROPERTY); if (username != null && password != null) { if (realm == null && logger.isWarnEnabled()) { logger.warn("In order to use JettyClient with BASIC Authentication " + "you should provide Constants.ROP_SERVICE_REALM_PROPERTY."); return; } if (logger.isInfoEnabled()) { logger.info( "Adding authentication" + "\nUser: " + username + "\nRealm: " + realm); } AuthenticationStore auth = httpClient.getAuthenticationStore(); auth.addAuthentication(new BasicAuthentication(URI.create(url), realm, username, password)); } }
httpClient.getAuthenticationStore().addAuthenticationResult(new BasicAuthentication.BasicResult(uri, user.get(), password.or("")));
proxies.add(proxy); authStore.addAuthentication( new BasicAuthentication(proxy.getURI(), Authentication.ANY_REALM, proxyUser, proxyPassword));
final Object basicAuthProvider = config.getProperty(JettyClientProperties.PREEMPTIVE_BASIC_AUTHENTICATION); if (basicAuthProvider != null && (basicAuthProvider instanceof BasicAuthentication)) { auth.addAuthentication((BasicAuthentication) basicAuthProvider);
proxies.add(proxy); authStore.addAuthentication( new BasicAuthentication(proxy.getURI(), Authentication.ANY_REALM, proxyUser, proxyPassword));