Custom AuthenticationEntryPoint

A custom AuthenticationEntryPoint can be used to set necessary response headers, content-type, and so on before sending the response back to the client.

The org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint class is a built-in AuthenticationEntryPoint implementation, which will get invoked for basic authentication to commence. A custom entry point can be created by implementing the org.springframework.security.web.AuthenticationEntryPoint interface. The following is an example implementation:

@Componentpublic final class CustomAuthenticationEntryPoint implements         AuthenticationEntryPoint {    @Override    public void commence(final HttpServletRequest request, final  HttpServletResponse ...

Get Hands-On Spring Security 5 for Reactive Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.