Spring Security
# Architecture
# Flow
User sends a request to the application.
Spring Security intercepts the request and checks if the user is authenticated.
If the user is not authenticated, Spring Security redirects the user to the login page.
The user submits their credentials to the login page.
Spring Security authenticates the user by checking their credentials against the authentication provider. This could be a database, an LDAP server, or any other authentication source.
If the authentication is successful, Spring Security creates an authentication token that contains information about the authenticated user, such as their username, authorities, and other details.
The authentication token is stored in the security context, which is a container that holds information about the security state of the application.
Spring Security continues processing the request, checking the authorization rules to determine if the user has the necessary permissions to access the requested resource.
If the authorization is successful, the request is allowed to continue to the target resource.
If the authorization fails, Spring Security returns a 401 Unauthorized response to the user.