Skip to content

Commit feff747

Browse files
committed
Polish multiple RequestRejectedHandlers support
Issue gh-10603
1 parent 27cfb9c commit feff747

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/builders/WebSecurity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

web/src/main/java/org/springframework/security/web/firewall/CompositeRequestRejectedHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public CompositeRequestRejectedHandler(RequestRejectedHandler... requestRejected
5050
@Override
5151
public void handle(HttpServletRequest request, HttpServletResponse response,
5252
RequestRejectedException requestRejectedException) throws IOException, ServletException {
53-
for (RequestRejectedHandler requestRejectedhandler : requestRejectedhandlers) {
53+
for (RequestRejectedHandler requestRejectedhandler : this.requestRejectedhandlers) {
5454
requestRejectedhandler.handle(request, response, requestRejectedException);
5555
}
5656
}

web/src/test/java/org/springframework/security/web/firewall/CompositeRequestRejectedHandlerTests.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,9 +29,9 @@ public class CompositeRequestRejectedHandlerTests {
2929
@Test
3030
void compositeRequestRejectedHandlerRethrowsTheException() {
3131
RequestRejectedException requestRejectedException = new RequestRejectedException("rejected");
32-
DefaultRequestRejectedHandler sut = new DefaultRequestRejectedHandler();
33-
CompositeRequestRejectedHandler crrh = new CompositeRequestRejectedHandler(sut);
34-
assertThatExceptionOfType(RequestRejectedException.class).isThrownBy(() -> crrh
32+
CompositeRequestRejectedHandler handler = new CompositeRequestRejectedHandler(
33+
new DefaultRequestRejectedHandler());
34+
assertThatExceptionOfType(RequestRejectedException.class).isThrownBy(() -> handler
3535
.handle(mock(HttpServletRequest.class), mock(HttpServletResponse.class), requestRejectedException))
3636
.withMessage("rejected");
3737
}

0 commit comments

Comments
 (0)