File tree Expand file tree Collapse file tree
spring-security-mvc-boot/src/main Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88import org .springframework .security .config .annotation .web .configuration .WebSecurityConfigurerAdapter ;
99
1010@ Configuration
11- @ EnableWebSecurity
11+ @ EnableWebSecurity //(debug = true)
1212public class SecurityConfig extends WebSecurityConfigurerAdapter {
1313
1414 @ Autowired
Original file line number Diff line number Diff line change 11package org .baeldung .ip .web ;
22
3+ import java .util .List ;
4+
5+ import javax .servlet .Filter ;
36import javax .servlet .http .HttpServletRequest ;
47
58import org .baeldung .custom .persistence .model .Foo ;
9+ import org .springframework .beans .factory .annotation .Autowired ;
10+ import org .springframework .beans .factory .annotation .Qualifier ;
11+ import org .springframework .security .web .FilterChainProxy ;
12+ import org .springframework .security .web .SecurityFilterChain ;
613import org .springframework .stereotype .Controller ;
714import org .springframework .web .bind .annotation .PathVariable ;
815import org .springframework .web .bind .annotation .RequestMapping ;
1219@ Controller
1320public class MainController {
1421
22+ @ Autowired
23+ @ Qualifier ("springSecurityFilterChain" )
24+ private Filter springSecurityFilterChain ;
25+
1526 @ RequestMapping (method = RequestMethod .GET , value = "/foos/{id}" )
1627 @ ResponseBody
1728 public Foo findById (@ PathVariable final long id , HttpServletRequest request ) {
29+ FilterChainProxy filterChainProxy = (FilterChainProxy ) springSecurityFilterChain ;
30+ List <SecurityFilterChain > list = filterChainProxy .getFilterChains ();
31+ list .forEach (chain -> chain .getFilters ()
32+ .forEach (filter -> System .out .println (filter .getClass ())));
33+
1834 return new Foo ("Sample" );
1935 }
2036
Original file line number Diff line number Diff line change @@ -6,4 +6,7 @@ spring.datasource.password=
66spring.jpa.hibernate.ddl-auto =create-drop
77spring.jpa.database =H2
88spring.jpa.show-sql =false
9- spring.jpa.properties.hibernate.dialect =org.hibernate.dialect.H2Dialect
9+ spring.jpa.properties.hibernate.dialect =org.hibernate.dialect.H2Dialect
10+
11+
12+ # logging.level.org.springframework.security.web.FilterChainProxy=DEBUG
You can’t perform that action at this time.
0 commit comments