mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-23 12:32:13 +00:00
Polish DefaultSecurityFilterChain Logs
Reuse String manipulation logic in Spring Framework Compress whitespace Closes gh-15096
This commit is contained in:
parent
ac9bdf5cbf
commit
6956ed693c
@ -27,6 +27,7 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
|
|
||||||
import org.springframework.core.log.LogMessage;
|
import org.springframework.core.log.LogMessage;
|
||||||
import org.springframework.security.web.util.matcher.RequestMatcher;
|
import org.springframework.security.web.util.matcher.RequestMatcher;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard implementation of {@code SecurityFilterChain}.
|
* Standard implementation of {@code SecurityFilterChain}.
|
||||||
@ -52,18 +53,12 @@ public final class DefaultSecurityFilterChain implements SecurityFilterChain {
|
|||||||
logger.debug(LogMessage.format("Will not secure %s", requestMatcher));
|
logger.debug(LogMessage.format("Will not secure %s", requestMatcher));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
StringBuilder filterClassNames = new StringBuilder();
|
List<String> filterNames = new ArrayList<>();
|
||||||
String separator = ", ";
|
for (Filter filter : filters) {
|
||||||
|
filterNames.add(filter.getClass().getSimpleName());
|
||||||
for (Filter f : filters) {
|
|
||||||
if (!filterClassNames.isEmpty()) {
|
|
||||||
filterClassNames.append(separator);
|
|
||||||
}
|
|
||||||
filterClassNames.append(f.getClass().getSimpleName());
|
|
||||||
}
|
}
|
||||||
|
String names = StringUtils.collectionToDelimitedString(filterNames, ", ");
|
||||||
logger.debug(
|
logger.debug(LogMessage.format("Will secure %s with filters: %s", requestMatcher, names));
|
||||||
LogMessage.format("Will secure %s with filters: %s", requestMatcher, filterClassNames.toString()));
|
|
||||||
}
|
}
|
||||||
this.requestMatcher = requestMatcher;
|
this.requestMatcher = requestMatcher;
|
||||||
this.filters = new ArrayList<>(filters);
|
this.filters = new ArrayList<>(filters);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user