File tree Expand file tree Collapse file tree
src/main/java/com/baeldung/spring/session/tomcatex
tomcat-session-demo/src/main/java/com/baeldung/spring/session/tomcatex Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3737 <groupId >org.springframework.boot</groupId >
3838 <artifactId >spring-boot-starter-web</artifactId >
3939 </dependency >
40+ <dependency >
41+ <groupId >org.springframework.boot</groupId >
42+ <artifactId >spring-boot-starter-test</artifactId >
43+ <scope >test</scope >
44+ </dependency >
4045 </dependencies >
4146
4247 <dependencyManagement >
Load diff This file was deleted.
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
1414 @ Autowired
1515 public void configureGlobal (AuthenticationManagerBuilder auth ) throws Exception {
1616 auth .inMemoryAuthentication ()
17- .withUser ("user" ).password ("password" ).roles ("USER" ).and ()
1817 .withUser ("admin" ).password ("password" ).roles ("ADMIN" );
1918 }
2019
@@ -23,8 +22,6 @@ protected void configure(HttpSecurity http) throws Exception {
2322 http
2423 .httpBasic ().and ()
2524 .authorizeRequests ()
26- .antMatchers ("/" ).permitAll ()
27- .antMatchers ("/tomcat" ).hasRole ("USER" )
2825 .antMatchers ("/tomcat/admin" ).hasRole ("ADMIN" )
2926 .anyRequest ().authenticated ();
3027 }
Original file line number Diff line number Diff line change 55
66@ RestController
77public class TestController {
8-
9- @ RequestMapping
10- public String helloDefault () {
11- return "hello default" ;
12- }
13-
14- @ RequestMapping ("/tomcat" )
15- public String helloTomcat () {
16- return "hello tomcat" ;
17- }
18-
198 @ RequestMapping ("/tomcat/admin" )
209 public String helloTomcatAdmin () {
2110 return "hello tomcat admin" ;
You can’t perform that action at this time.
0 commit comments