File tree 1 file changed +7
-0
lines changed
web/src/main/java/org/springframework/security/web/access
1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 3
3
import jakarta .servlet .ServletException ;
4
4
import jakarta .servlet .http .HttpServletRequest ;
5
5
import jakarta .servlet .http .HttpServletResponse ;
6
+ import org .apache .commons .logging .Log ;
7
+ import org .apache .commons .logging .LogFactory ;
8
+ import org .springframework .core .log .LogMessage ;
6
9
import org .springframework .http .HttpStatus ;
7
10
import org .springframework .security .access .AccessDeniedException ;
8
11
import org .springframework .util .Assert ;
11
14
12
15
public class HttpStatusAccessDeniedHandler implements AccessDeniedHandler {
13
16
17
+ protected static final Log logger = LogFactory .getLog (HttpStatusAccessDeniedHandler .class );
18
+
14
19
private final HttpStatus httpStatus ;
15
20
16
21
public HttpStatusAccessDeniedHandler (HttpStatus httpStatus ) {
@@ -21,6 +26,8 @@ public HttpStatusAccessDeniedHandler(HttpStatus httpStatus) {
21
26
@ Override
22
27
public void handle (HttpServletRequest request , HttpServletResponse response ,
23
28
AccessDeniedException accessDeniedException ) throws IOException , ServletException {
29
+ logger .debug (LogMessage .format ("Access denied with status code %d" , this .httpStatus .value ()));
30
+
24
31
response .sendError (this .httpStatus .value (), "Access Denied" );
25
32
}
26
33
You can’t perform that action at this time.
0 commit comments