scratches / spring-boot-sample-gae

Spring Boot Sample for Google AppEngine
32 stars 10 forks source link

Does this work with spring-boot-web-security? #8

Open jamesclark92 opened 8 years ago

jamesclark92 commented 8 years ago

My Main Controller class:

@Configuration
@ComponentScan({"com.football_preds"})
@EnableAutoConfiguration
@Controller
public class BaseController {

    // Map all urls to this method aside from ones starting with api
    @RequestMapping(value = "/**")
    public String getIndex() {
        return "/views/index.jsp";
    }

    @Configuration
    @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
    @EnableWebSecurity
    public static class SpringSecurityConfig extends WebSecurityConfigurerAdapter {

        @Override
        protected void configure(HttpSecurity http) throws Exception {
            http.authorizeRequests()
                    .anyRequest()
                    .authenticated();
        }

        @Autowired
        public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
            auth.inMemoryAuthentication()
                    .withUser("user").password("pass").roles("USER");
        }
    }
}
dsyer commented 8 years ago

Yes, I believe so. You have to declare the security filter in web.xml of course.