(118) - Add java-config(零配置) 的支持

2.0.0
Li Shengzhao 2016-04-04 19:32:54 +08:00
parent 863de2f709
commit c636a7a672
2 changed files with 26 additions and 10 deletions

View File

@ -0,0 +1,25 @@
package com.monkeyk.sos.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.expression.method.MethodSecurityExpressionHandler;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration;
import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler;
/**
* 2016/4/4
*
* @author Shengzhao Li
*/
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true)
public class MethodSecurityConfig extends GlobalMethodSecurityConfiguration {
@Override
protected MethodSecurityExpressionHandler createExpressionHandler() {
return new OAuth2MethodSecurityExpressionHandler();
// return new DefaultMethodSecurityExpressionHandler();
}
}

View File

@ -184,14 +184,5 @@ public class WebSecurityConfigurer extends WebSecurityConfigurerAdapter {
// }
// @Configuration
// @EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true)
// protected static class MethodSecurityConfig extends GlobalMethodSecurityConfiguration {
//
//
// @Override
// protected MethodSecurityExpressionHandler createExpressionHandler() {
// return new OAuth2MethodSecurityExpressionHandler();
// }
// }
}