Search IconIcon to open search

Spring Security

Last updated Feb 3, 2023

# Architecture

# Flow

  1. User sends a request to the application.

  2. Spring Security intercepts the request and checks if the user is authenticated.

  3. If the user is not authenticated, Spring Security redirects the user to the login page.

  4. The user submits their credentials to the login page.

  5. 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.

  6. 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.

  7. The authentication token is stored in the security context, which is a container that holds information about the security state of the application.

  8. Spring Security continues processing the request, checking the authorization rules to determine if the user has the necessary permissions to access the requested resource.

  9. If the authorization is successful, the request is allowed to continue to the target resource.

  10. If the authorization fails, Spring Security returns a 401 Unauthorized response to the user.

# Servlet Filters