
http.sessionManagement()
// SpringSecurity不會使用也不會建立HttpSession執行個體
.sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().authorizeRequests()
// swagger請求
.antMatchers("/swagger-ui.html", "/webjars/**", "/swagger-resources/**","/v2/**").permitAll()
// 所有請求,都需要有all範圍(scope)
.antMatchers("/**").access("#oauth2.hasScope('xxx')").anyRequest().authenticated().and().csrf()
.disable();