Skip to content

Commit 51d4eac

Browse files
committed
Refactored Http403ForbiddenEntryPoint to use HttpStatus.FORBIDDEN.value() gh-16615
1 parent 776eb76 commit 51d4eac

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: web/src/main/java/org/springframework/security/web/authentication/Http403ForbiddenEntryPoint.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -23,6 +23,7 @@
2323
import org.apache.commons.logging.Log;
2424
import org.apache.commons.logging.LogFactory;
2525

26+
import org.springframework.http.HttpStatus;
2627
import org.springframework.security.core.AuthenticationException;
2728
import org.springframework.security.web.AuthenticationEntryPoint;
2829

@@ -55,7 +56,7 @@ public class Http403ForbiddenEntryPoint implements AuthenticationEntryPoint {
5556
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException arg2)
5657
throws IOException {
5758
logger.debug("Pre-authenticated entry point called. Rejecting access");
58-
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Access Denied");
59+
response.sendError(HttpStatus.FORBIDDEN.value(), HttpStatus.FORBIDDEN.getReasonPhrase());
5960
}
6061

6162
}

0 commit comments

Comments
 (0)