Home  >  Article  >  Java  >  Spring Security Principles

Spring Security Principles

Guanhui
GuanhuiOriginal
2020-06-23 14:42:063311browse

Spring Security Principles

Spring Security Principle

Spring Security adopts the chain of responsibility design pattern. There is a long filter chain. First, the client Initiate a request, enter the Security filter chain, then determine whether it is a login, and finally find the corresponding authentication manager based on the URI for authentication.

flow chart

Spring Security Principles

Process Description

  • #The client initiates a request and enters the Security filter chain.

  • When reaching the LogoutFilter, determine whether it is the logout path. If it is the logout path, go to the logoutHandler. If the logout is successful, go to the logoutSuccessHandler to process the logout successfully. If the logout fails, then By ExceptionTranslationFilter; if it is not the logout path, go directly to the next filter.

  • When reaching the UsernamePasswordAuthenticationFilter, determine whether it is the login path. If so, enter the filter to perform the login operation. If the login fails, go to the AuthenticationFailureHandler login failure handler for processing. If the login is successful, Then go to the AuthenticationSuccessHandler login success processor for processing. If it is not a login request, it will not enter the filter.

  • When you get to the FilterSecurityInterceptor, you will get the uri. According to the uri, you will find the corresponding authentication manager. The authentication manager will do the authentication work. If the authentication is successful, go to the Controller layer. Otherwise, go to the Controller layer. Go to the AccessDeniedHandler authentication failure handler for processing.

Recommended tutorial: "Java Tutorial"

The above is the detailed content of Spring Security Principles. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn