From 51d4eac0214ddc5444d1ddcbaf1077fdcdb78464 Mon Sep 17 00:00:00 2001 From: yelm-212 <21yrshin@naver.com> Date: Tue, 18 Feb 2025 13:23:30 +0900 Subject: [PATCH] Refactored Http403ForbiddenEntryPoint to use HttpStatus.FORBIDDEN.value() gh-16615 --- .../web/authentication/Http403ForbiddenEntryPoint.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/src/main/java/org/springframework/security/web/authentication/Http403ForbiddenEntryPoint.java b/web/src/main/java/org/springframework/security/web/authentication/Http403ForbiddenEntryPoint.java index 1fc9025b0a4..511b5928fc5 100755 --- a/web/src/main/java/org/springframework/security/web/authentication/Http403ForbiddenEntryPoint.java +++ b/web/src/main/java/org/springframework/security/web/authentication/Http403ForbiddenEntryPoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 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. @@ -23,6 +23,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.springframework.http.HttpStatus; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; @@ -55,7 +56,7 @@ public class Http403ForbiddenEntryPoint implements AuthenticationEntryPoint { public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException arg2) throws IOException { logger.debug("Pre-authenticated entry point called. Rejecting access"); - response.sendError(HttpServletResponse.SC_FORBIDDEN, "Access Denied"); + response.sendError(HttpStatus.FORBIDDEN.value(), HttpStatus.FORBIDDEN.getReasonPhrase()); } }