protected Service populateAttributes(final Service service, final HttpServletRequest request) {
        val attributes = (Map) request.getParameterMap()
            .entrySet()
            .stream()
            .filter(entry -> !IGNORED_ATTRIBUTES_PARAMS.contains(entry.getKey()))
            .map(entry -> Pair.of(entry.getKey(), CollectionUtils.toCollection(entry.getValue(), ArrayList.class)))
            .collect(Collectors.toMap(Pair::getKey, Pair::getValue));
        attributes.putAll(extractQueryParameters(service));

        val collectAttributes = Objects.requireNonNullElse((Boolean) request.getAttribute(COLLECT_SERVICE_ATTRIBUTES), Boolean.TRUE);
        if (collectAttributes) {
            val httpRequest = new LinkedHashMap<>();
            FunctionUtils.doIfNotBlank(request.getPathInfo(), value -> collectHttpRequestProperty("pathInfo", value, httpRequest));
            FunctionUtils.doIfNotBlank(request.getMethod(), value -> collectHttpRequestProperty("httpMethod", value, httpRequest));
            FunctionUtils.doIfNotBlank(request.getRequestURL(), value -> collectHttpRequestProperty("requestURL", value.toString(), httpRequest));
            FunctionUtils.doIfNotBlank(request.getRequestURI(), value -> collectHttpRequestProperty("requestURI", value, httpRequest));
            FunctionUtils.doIfNotBlank(request.getRequestId(), value -> collectHttpRequestProperty("requestId", value, httpRequest));
            FunctionUtils.doIfNotBlank(request.getContentType(), value -> collectHttpRequestProperty("contentType", value, httpRequest));
            FunctionUtils.doIfNotBlank(request.getContextPath(), value -> collectHttpRequestProperty("contextPath", value, httpRequest));
            FunctionUtils.doIfNotBlank(request.getLocalName(), value -> collectHttpRequestProperty("localeName", value, httpRequest));
            if (!httpRequest.isEmpty()) {
                attributes.put(Service.SERVICE_ATTRIBUTE_HTTP_REQUEST, httpRequest);
            }

            val cookies = new LinkedHashMap<>();
            FunctionUtils.doIfNotNull(request.getCookies(), __ -> Arrays.stream(request.getCookies())
                .forEach(cookie -> collectHttpRequestProperty("cookie-%s".formatted(cookie.getName()), cookie.getValue(), cookies)));
            if (!cookies.isEmpty()) {
                attributes.put(Service.SERVICE_ATTRIBUTE_COOKIES, cookies);
            }
            
            val headers = new LinkedHashMap<>();
            FunctionUtils.doIfNotNull(request.getHeaderNames(), __ -> StreamSupport.stream(
                    Spliterators.spliteratorUnknownSize(request.getHeaderNames().asIterator(), Spliterator.ORDERED), false)
                .forEach(header -> collectHttpRequestProperty("header-%s".formatted(header), request.getHeader(header), headers)));
            if (!headers.isEmpty()) {
                attributes.put(Service.SERVICE_ATTRIBUTE_HEADERS, headers);
            }
        }

        LOGGER.trace("Extracted attributes [{}] for service [{}]", attributes, service.getId());
        service.setAttributes(attributes);
        tenantExtractor.extract(request)
            .map(TenantDefinition::getId)
            .ifPresent(service::setTenant);
        return service;
    }
Cleanup the url. Removes jsession ids and query strings.

@param url the url
@return sanitized url.
core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/AbstractServiceFactory.java