BAEL-89 - reformatting source - adding packaging to pom to parent spring-session module
This commit is contained in:
parent
9bf8fee210
commit
ef09007932
|
@ -8,17 +8,17 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@SpringBootApplication
|
||||
@RestController
|
||||
public class JettyWebApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(JettyWebApplication.class, args);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(JettyWebApplication.class, args);
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
public String helloJetty() {
|
||||
return "hello Jetty";
|
||||
}
|
||||
@RequestMapping
|
||||
public String helloJetty() {
|
||||
return "hello Jetty";
|
||||
}
|
||||
|
||||
@RequestMapping("/test")
|
||||
public String lksjdf() {
|
||||
return "";
|
||||
}
|
||||
@RequestMapping("/test")
|
||||
public String lksjdf() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,12 +10,12 @@ import org.springframework.security.config.http.SessionCreationPolicy;
|
|||
@EnableWebSecurity
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.NEVER)
|
||||
.and()
|
||||
.authorizeRequests().anyRequest().hasRole("ADMIN");
|
||||
}
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.sessionManagement()
|
||||
.sessionCreationPolicy(SessionCreationPolicy.NEVER)
|
||||
.and()
|
||||
.authorizeRequests().anyRequest().hasRole("ADMIN");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.springframework.session.web.http.HttpSessionStrategy;
|
|||
@Configuration
|
||||
@EnableRedisHttpSession
|
||||
public class SessionConfig extends AbstractHttpSessionApplicationInitializer {
|
||||
@Bean
|
||||
public HttpSessionStrategy httpSessionStrategy() {
|
||||
return new HeaderHttpSessionStrategy();
|
||||
}
|
||||
@Bean
|
||||
public HttpSessionStrategy httpSessionStrategy() {
|
||||
return new HeaderHttpSessionStrategy();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
server.port=8081
|
||||
|
||||
spring.redis.host=localhost
|
||||
spring.redis.port=6379
|
|
@ -4,6 +4,7 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
|
@ -12,6 +13,7 @@
|
|||
|
||||
<artifactId>spring-session</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<modules>
|
||||
<module>jetty-session-demo</module>
|
||||
|
|
|
@ -11,21 +11,21 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
|||
@EnableWebSecurity
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.inMemoryAuthentication()
|
||||
.withUser("user").password("password").roles("USER").and()
|
||||
.withUser("admin").password("password").roles("ADMIN");
|
||||
}
|
||||
@Autowired
|
||||
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.inMemoryAuthentication()
|
||||
.withUser("user").password("password").roles("USER").and()
|
||||
.withUser("admin").password("password").roles("ADMIN");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.httpBasic().and()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/").permitAll()
|
||||
.antMatchers("/tomcat").hasRole("USER")
|
||||
.antMatchers("/tomcat/admin").hasRole("ADMIN")
|
||||
.anyRequest().authenticated();
|
||||
}
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.httpBasic().and()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/").permitAll()
|
||||
.antMatchers("/tomcat").hasRole("USER")
|
||||
.antMatchers("/tomcat/admin").hasRole("ADMIN")
|
||||
.anyRequest().authenticated();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,22 +8,22 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@SpringBootApplication
|
||||
@RestController
|
||||
public class TomcatWebApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(TomcatWebApplication.class, args);
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(TomcatWebApplication.class, args);
|
||||
}
|
||||
|
||||
@RequestMapping
|
||||
public String helloDefault() {
|
||||
return "hello default";
|
||||
}
|
||||
@RequestMapping
|
||||
public String helloDefault() {
|
||||
return "hello default";
|
||||
}
|
||||
|
||||
@RequestMapping("/tomcat")
|
||||
public String helloTomcat() {
|
||||
return "hello tomcat";
|
||||
}
|
||||
@RequestMapping("/tomcat")
|
||||
public String helloTomcat() {
|
||||
return "hello tomcat";
|
||||
}
|
||||
|
||||
@RequestMapping("/tomcat/admin")
|
||||
public String helloTomcatAdmin() {
|
||||
return "hello tomcat admin";
|
||||
}
|
||||
@RequestMapping("/tomcat/admin")
|
||||
public String helloTomcatAdmin() {
|
||||
return "hello tomcat admin";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue