/** * Execute http response. * * @param url the url * @param method the method * @param basicAuthUsername the basic auth username * @param basicAuthPassword the basic auth password * @param parameters the parameters * @param headers the headers * @return the http response */ public static HttpResponse execute(final String url, final String method, final String basicAuthUsername, final String basicAuthPassword, final Map<String, Object> parameters, final Map<String, Object> headers) { return execute(url, method, basicAuthUsername, basicAuthPassword, parameters, headers, null); }
/** * Execute http response. * * @param url the url * @param method the method * @param headers the headers * @return the http response */ public static HttpResponse execute(final String url, final String method, final Map<String, Object> headers) { return execute(url, method, null, null, new HashMap<>(), headers); }
/** * Execute http response. * * @param url the url * @param method the method * @param basicAuthUsername the basic auth username * @param basicAuthPassword the basic auth password * @param headers the headers * @return the http response */ public static HttpResponse execute(final String url, final String method, final String basicAuthUsername, final String basicAuthPassword, final Map<String, Object> headers) { return execute(url, method, basicAuthUsername, basicAuthPassword, new HashMap<>(), headers); }
/** * Execute http response. * * @param url the url * @param method the method * @return the http response */ public static HttpResponse execute(final String url, final String method) { return execute(url, method, null, null, new HashMap<>(), new HashMap<>()); }
/** * Execute http response. * * @param url the url * @param method the method * @param basicAuthUsername the basic auth username * @param basicAuthPassword the basic auth password * @return the http response */ public static HttpResponse execute(final String url, final String method, final String basicAuthUsername, final String basicAuthPassword) { return execute(url, method, basicAuthUsername, basicAuthPassword, new HashMap<>(), new HashMap<>()); }
/** * Execute get http response. * * @param url the url * @param parameters the parameters * @param headers the headers * @return the http response */ public static HttpResponse executeGet(final String url, final Map<String, Object> parameters, final Map<String, Object> headers) { try { return execute(url, HttpMethod.GET.name(), null, null, parameters, headers); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
/** * Execute post http response. * * @param url the url * @param parameters the parameters * @param headers the headers * @return the http response */ public static HttpResponse executePost(final String url, final Map<String, Object> parameters, final Map<String, Object> headers) { try { return execute(url, HttpMethod.POST.name(), null, null, parameters, headers, null); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
/** * Execute get http response. * * @param url the url * @param basicAuthUsername the basic auth username * @param basicAuthPassword the basic auth password * @param parameters the parameters * @param headers the headers * @return the http response */ public static HttpResponse executeGet(final String url, final String basicAuthUsername, final String basicAuthPassword, final Map<String, Object> parameters, final Map<String, Object> headers) { try { return execute(url, HttpMethod.GET.name(), basicAuthUsername, basicAuthPassword, parameters, headers); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
/** * Execute post http response. * * @param url the url * @param basicAuthUsername the basic auth username * @param basicAuthPassword the basic auth password * @param entity the entity * @param parameters the parameters * @param headers the headers * @return the http response */ public static HttpResponse executePost(final String url, final String basicAuthUsername, final String basicAuthPassword, final String entity, final Map<String, Object> parameters, final Map<String, Object> headers) { try { return execute(url, HttpMethod.POST.name(), basicAuthUsername, basicAuthPassword, parameters, headers, entity); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
@Override @SneakyThrows public void decorate(final RequestContext requestContext, final ApplicationContext applicationContext) { HttpResponse response = null; try { response = HttpUtils.execute(restProperties.getUrl(), restProperties.getUrl(), restProperties.getBasicAuthUsername(), restProperties.getBasicAuthPassword()); val statusCode = response.getStatusLine().getStatusCode(); if (response != null && HttpStatus.valueOf(statusCode).is2xxSuccessful()) { val jsonObject = MAPPER.readValue(response.getEntity().getContent(), Map.class); requestContext.getFlowScope().put("decoration", jsonObject); } } finally { HttpUtils.close(response); } } }
response = HttpUtils.execute(restProperties.getUrl(), restProperties.getMethod(), restProperties.getBasicAuthUsername(), restProperties.getBasicAuthPassword(), parameters, headers);
response = HttpUtils.execute(url, HttpMethod.GET.name()); if (response == null) { return bannedResponse;
response = HttpUtils.execute(rest.getUrl(), rest.getMethod(), rest.getBasicAuthUsername(), rest.getBasicAuthPassword(), headers); val statusCode = response.getStatusLine().getStatusCode(); if (response != null && HttpStatus.valueOf(statusCode).is2xxSuccessful()) {
@Override public boolean shouldMultifactorAuthenticationProviderExecute(final Authentication authentication, final RegisteredService registeredService, final MultifactorAuthenticationProvider provider, final HttpServletRequest request) { try { val principal = authentication.getPrincipal(); val rest = bypassProperties.getRest(); LOGGER.debug("Evaluating multifactor authentication bypass properties for principal [{}], " + "service [{}] and provider [{}] via REST endpoint [{}]", principal.getId(), registeredService, provider, rest.getUrl()); val parameters = CollectionUtils.wrap("principal", principal.getId(), "provider", provider.getId()); if (registeredService != null) { parameters.put("service", registeredService.getServiceId()); } val response = HttpUtils.execute(rest.getUrl(), rest.getMethod(), rest.getBasicAuthUsername(), rest.getBasicAuthPassword(), parameters, new HashMap<>()); return response.getStatusLine().getStatusCode() == HttpStatus.ACCEPTED.value(); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); return true; } } }
response = HttpUtils.execute(restProperties.getUrl(), HttpMethod.GET.name(), restProperties.getBasicAuthUsername(), restProperties.getBasicAuthPassword(), parameters, new HashMap<>());