@@ -34,18 +34,21 @@ public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter
34
34
@ Override
35
35
public void configure (final HttpSecurity http ) throws Exception {
36
36
// @formatter:off
37
- http
38
- .sessionManagement ().sessionCreationPolicy (SessionCreationPolicy .IF_REQUIRED )
39
- .and ().authorizeRequests ().anyRequest ().authenticated ();
40
- // .requestMatchers().antMatchers("/foos/**","/bars/**")
41
- // .and()
42
- // .authorizeRequests()
43
- // .antMatchers(HttpMethod.GET,"/foos/**").access("#oauth2.hasScope('foo') and #oauth2.hasScope('read')")
44
- // .antMatchers(HttpMethod.POST,"/foos/**").access("#oauth2.hasScope('foo') and #oauth2.hasScope('write')")
45
- // .antMatchers(HttpMethod.GET,"/bars/**").access("#oauth2.hasScope('bar') and #oauth2.hasScope('read')")
46
- // .antMatchers(HttpMethod.POST,"/bars/**").access("#oauth2.hasScope('bar') and #oauth2.hasScope('write') and hasRole('ROLE_ADMIN')")
47
- ;
48
- // @formatter:on
37
+ http .sessionManagement ().sessionCreationPolicy (SessionCreationPolicy .IF_REQUIRED ).and ().authorizeRequests ()
38
+ .anyRequest ().authenticated ();
39
+ // .requestMatchers().antMatchers("/foos/**","/bars/**")
40
+ // .and()
41
+ // .authorizeRequests()
42
+ // .antMatchers(HttpMethod.GET,"/foos/**").access("#oauth2.hasScope('foo')
43
+ // and #oauth2.hasScope('read')")
44
+ // .antMatchers(HttpMethod.POST,"/foos/**").access("#oauth2.hasScope('foo')
45
+ // and #oauth2.hasScope('write')")
46
+ // .antMatchers(HttpMethod.GET,"/bars/**").access("#oauth2.hasScope('bar')
47
+ // and #oauth2.hasScope('read')")
48
+ // .antMatchers(HttpMethod.POST,"/bars/**").access("#oauth2.hasScope('bar')
49
+ // and #oauth2.hasScope('write') and hasRole('ROLE_ADMIN')")
50
+ ;
51
+ // @formatter:on
49
52
}
50
53
51
54
@ Override
@@ -84,19 +87,15 @@ public DefaultTokenServices tokenServices() {
84
87
// JDBC token store configuration
85
88
86
89
/*
87
- @Bean
88
- public DataSource dataSource() {
89
- final DriverManagerDataSource dataSource = new DriverManagerDataSource();
90
- dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName"));
91
- dataSource.setUrl(env.getProperty("jdbc.url"));
92
- dataSource.setUsername(env.getProperty("jdbc.user"));
93
- dataSource.setPassword(env.getProperty("jdbc.pass"));
94
- return dataSource;
95
- }
96
-
97
- @Bean
98
- public TokenStore tokenStore() {
99
- return new JdbcTokenStore(dataSource());
100
- }
101
- */
90
+ * @Bean public DataSource dataSource() { final DriverManagerDataSource
91
+ * dataSource = new DriverManagerDataSource();
92
+ * dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName"));
93
+ * dataSource.setUrl(env.getProperty("jdbc.url"));
94
+ * dataSource.setUsername(env.getProperty("jdbc.user"));
95
+ * dataSource.setPassword(env.getProperty("jdbc.pass")); return dataSource;
96
+ * }
97
+ *
98
+ * @Bean public TokenStore tokenStore() { return new
99
+ * JdbcTokenStore(dataSource()); }
100
+ */
102
101
}
0 commit comments