Package api.mpba.rastvdmy.config
Class AuthenticationEntryPointImpl
java.lang.Object
api.mpba.rastvdmy.config.AuthenticationEntryPointImpl
- All Implemented Interfaces:
 org.springframework.security.web.AuthenticationEntryPoint
@Component
public class AuthenticationEntryPointImpl
extends Object
implements org.springframework.security.web.AuthenticationEntryPoint
Custom implementation of 
AuthenticationEntryPoint used to handle authentication exceptions.
 This class serves as an entry point for unauthenticated requests and utilizes a HandlerExceptionResolver
 to resolve the authentication exception.
 It is primarily used in security configurations to handle cases where a user tries to access a resource without proper authentication, by resolving the exception and responding accordingly.
- 
Constructor Summary
ConstructorsConstructorDescriptionAuthenticationEntryPointImpl(org.springframework.web.servlet.HandlerExceptionResolver resolver) Constructor forAuthenticationEntryPointImplthat injects theHandlerExceptionResolverto handle the resolution of exceptions related to authentication. - 
Method Summary
Modifier and TypeMethodDescriptionvoidcommence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException authException) Handles the commencement of an authentication error response. 
- 
Constructor Details
- 
AuthenticationEntryPointImpl
public AuthenticationEntryPointImpl(@Qualifier("handlerExceptionResolver") org.springframework.web.servlet.HandlerExceptionResolver resolver) Constructor forAuthenticationEntryPointImplthat injects theHandlerExceptionResolverto handle the resolution of exceptions related to authentication.- Parameters:
 resolver- TheHandlerExceptionResolverused for handling exceptions.
 
 - 
 - 
Method Details
- 
commence
public void commence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.AuthenticationException authException) Handles the commencement of an authentication error response. This method is called whenever an unauthenticated user requests a secured HTTP resource, and anAuthenticationExceptionis thrown. The method delegates the exception resolution to the injectedHandlerExceptionResolver.- Specified by:
 commencein interfaceorg.springframework.security.web.AuthenticationEntryPoint- Parameters:
 request- The HTTP request that resulted in an authentication exception.response- The HTTP response to be sent.authException- The exception that was thrown when authentication failed.
 
 -