(118) - Add java-config(零配置) 的支持
parent
863de2f709
commit
c636a7a672
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue