Background
Hey, we have a project Springthat uses Spring security. We defined security filters by specifying
<b:bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
whith filter-chain-map
and in web.xmlwe perform
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
and everything works well :). Now when connecting Spring sessionwith redisaccording to the docfollowing next lines
<context:annotation-config />
<bean class="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"/>
create filterwith a name springSessionRepositoryFilter. Thus, basically, what we have done, in each user, filter-chainwe add this filter as the very first filter. i.e:
<b:bean id="springSecurityFilterChain" class="org.springframework.security.web.FilterChainProxy">
<filter-chain-map request-matcher="ant">
<filter-chain pattern="/api/someapieformobilelogin" filters="none" />
<filter-chain pattern="/api/**"
filters="springSessionRepositoryFilter, securityContextFilter,and some other spring security filter />
<filter-chain pattern="/**"
filters="springSessionRepositoryFilter, securityContextFilter,and some other spring security filter />
Results : the application works well, and also shows monitoringthrough redis-cliwhat Springcommunicates with redis.
Question
springSessionRepositoryFilter filter-chain? ?
,
, , Authenticate i.e
Authentication authentication = authenticationManager
.authenticate(authenticationToken);
SecurityContext securityContext = SecurityContextHolder
.getContext();
securityContext.setAuthentication(authentication);
. , , filter-chain org.springframework.security.web.FilterChainProxy.
, filter web.xml?
<filter>
<filter-name>springSessionRepositoryFilter</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSessionRepositoryFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
springSessionRepositoryFilter springSecurityFilterChain, org.springframework.web.filter.DelegatingFilterProxy . springSessionRepositoryFilter springSecurityFilterChain ?