My question has too many characters to post directly to Discord so here it is on StackOverflow: https://stackoverflow.com/questions/77958701/spring-security-default-login-endpoint-returns-404-no-static-resource-login
The gist is this:
- I've created Authentication and Authorization using JWT in cookies.
- My own custom classes include: CustomAuthenticationProvider, AuthenticationFilter, JWTGeneratorFilter, JWTAuthorizationFilter.
- To reduce the code as much as possible to find the error, I have removed everything except the AuthenticationFilter.
- I make a POST request, content-type JSON, etc, to localhost
localhost:8080/login. I have not created any controller handler methods or anything with the/loginendpoint, I haven't touched/login. - The user is authenticated correctly, the cookie is correctly assigned the JWT in the response.
- Near the end of the filter chain something goes wrong and I get the following response:
{
"type": "about:blank",
"title": "Not Found",
"status": 404,
"detail": "No static resource login.",
"instance": "/login"
}
- If I make a login request with incorrect credentials then it correctly returns my custom BadCredentials response.
There's lots more information in the SO thread that can't fit here.