From 7fbdacdd1b86de549b36088d6f7f66e670ed1798 Mon Sep 17 00:00:00 2001 From: Tran Ngoc Nhan Date: Sat, 10 May 2025 02:17:47 +0700 Subject: [PATCH] Cleanup code Signed-off-by: Tran Ngoc Nhan --- .../WebSessionServerRequestCache.java | 20 ++++--------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/web/src/main/java/org/springframework/security/web/server/savedrequest/WebSessionServerRequestCache.java b/web/src/main/java/org/springframework/security/web/server/savedrequest/WebSessionServerRequestCache.java index 2c1f8aac109..396d93fb25e 100644 --- a/web/src/main/java/org/springframework/security/web/server/savedrequest/WebSessionServerRequestCache.java +++ b/web/src/main/java/org/springframework/security/web/server/savedrequest/WebSessionServerRequestCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,7 +64,8 @@ public class WebSessionServerRequestCache implements ServerRequestCache { /** * Sets the matcher to determine if the request should be saved. The default is to * match on any GET request. - * @param saveRequestMatcher + * @param saveRequestMatcher the {@link ServerWebExchangeMatcher} that determines if + * the request should be saved */ public void setSaveRequestMatcher(ServerWebExchangeMatcher saveRequestMatcher) { Assert.notNull(saveRequestMatcher, "saveRequestMatcher cannot be null"); @@ -96,7 +97,7 @@ public Mono getRedirectUri(ServerWebExchange exchange) { public Mono removeMatchingRequest(ServerWebExchange exchange) { MultiValueMap queryParams = exchange.getRequest().getQueryParams(); if (this.matchingRequestParameterName != null && !queryParams.containsKey(this.matchingRequestParameterName)) { - this.logger.trace( + logger.trace( "matchingRequestParameterName is required for getMatchingRequest to lookup a value, but not provided"); return Mono.empty(); } @@ -165,17 +166,4 @@ private static ServerWebExchangeMatcher createDefaultRequestMatcher() { return new AndServerWebExchangeMatcher(get, notFavicon, html); } - private static String createQueryString(String queryString, String matchingRequestParameterName) { - if (matchingRequestParameterName == null) { - return queryString; - } - if (queryString == null || queryString.length() == 0) { - return matchingRequestParameterName; - } - if (queryString.endsWith("&")) { - return queryString + matchingRequestParameterName; - } - return queryString + "&" + matchingRequestParameterName; - } - }