/** * Fetch metadata http response. * * @param metadataLocation the metadata location * @return the http response */ protected HttpResponse fetchMetadata(final String metadataLocation) { LOGGER.debug("Fetching metadata from [{}]", metadataLocation); return HttpUtils.executeGet(metadataLocation, new LinkedHashMap<>()); }
/** * Execute get http response. * * @param url the url * @return the http response */ public static HttpResponse executeGet(final String url) { try { return executeGet(url, null, null, new LinkedHashMap<>()); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
/** * Execute get http response. * * @param url the url * @param parameters the parameters * @return the http response */ public static HttpResponse executeGet(final String url, final Map<String, Object> parameters) { try { return executeGet(url, null, null, parameters); } 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 * @return the http response */ public static HttpResponse executeGet(final String url, final String basicAuthUsername, final String basicAuthPassword) { try { return executeGet(url, basicAuthUsername, basicAuthPassword, new HashMap<>()); } 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 * @return the http response */ public static HttpResponse executeGet(final String url, final String basicAuthUsername, final String basicAuthPassword, final Map<String, Object> parameters) { try { return executeGet(url, basicAuthUsername, basicAuthPassword, parameters, new HashMap<>()); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
@Override public boolean doPrincipalAttributesAllowServiceAccess(final String principal, final Map<String, Object> principalAttributes) { try { if (super.doPrincipalAttributesAllowServiceAccess(principal, principalAttributes)) { val response = HttpUtils.executeGet(this.endpointUrl, CollectionUtils.wrap("username", principal)); val currentCodes = StringUtils.commaDelimitedListToSet(this.acceptableResponseCodes); return response != null && currentCodes.contains(String.valueOf(response.getStatusLine().getStatusCode())); } } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return false; }
@Override protected HttpResponse fetchMetadata(final String metadataLocation) { val metadata = samlIdPProperties.getMetadata(); val headers = new LinkedHashMap(); headers.put("Content-Type", metadata.getSupportedContentTypes()); headers.put("Accept", "*/*"); return HttpUtils.executeGet(metadataLocation, metadata.getBasicAuthnUsername(), samlIdPProperties.getMetadata().getBasicAuthnPassword(), new LinkedHashMap<>(), headers); }
val redirectUrl = encoder.getRedirectUrl(); LOGGER.trace("Final logout redirect URL is [{}]", redirectUrl); response = HttpUtils.executeGet(redirectUrl); } else { val payload = SerializeSupport.nodeToString(XMLObjectSupport.marshall(logoutRequest));
HttpResponse response = null; try { response = HttpUtils.executeGet(url); if (response != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { val result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
val url = resource.getURL().toExternalForm(); LOGGER.debug("Executing URL [{}] to determine theme for [{}]", url, service.getId()); response = HttpUtils.executeGet(url, CollectionUtils.wrap("service", service.getId())); if (response != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { val result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);