|
|
@ -25,7 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
|
|
import org.springframework.boot.autoconfigure.security.SecurityProperties;
|
|
|
|
import org.springframework.boot.autoconfigure.security.SecurityProperties;
|
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
|
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
|
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
|
|
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
|
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
|
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
|
|
@ -38,7 +38,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootApplication
|
|
|
|
@SpringBootApplication
|
|
|
|
@Controller
|
|
|
|
@Controller
|
|
|
|
public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
|
|
|
|
public class SampleWebSecureJdbcApplication extends WebMvcConfigurerAdapter {
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/")
|
|
|
|
@GetMapping("/")
|
|
|
|
public String home(Map<String, Object> model) {
|
|
|
|
public String home(Map<String, Object> model) {
|
|
|
@ -58,15 +58,11 @@ public class SampleWebSecureCustomApplication extends WebMvcConfigurerAdapter {
|
|
|
|
registry.addViewController("/login").setViewName("login");
|
|
|
|
registry.addViewController("/login").setViewName("login");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
public ApplicationSecurity applicationSecurity() {
|
|
|
|
|
|
|
|
return new ApplicationSecurity();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
new SpringApplicationBuilder(SampleWebSecureCustomApplication.class).run(args);
|
|
|
|
new SpringApplicationBuilder(SampleWebSecureJdbcApplication.class).run(args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration
|
|
|
|
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
|
|
|
|
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
|
|
|
|
protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter {
|
|
|
|
protected static class ApplicationSecurity extends WebSecurityConfigurerAdapter {
|
|
|
|
|
|
|
|
|