本文整理汇总了Java中org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler类的典型用法代码示例。如果您正苦于以下问题:Java DefaultMethodSecurityExpressionHandler类的具体用法?Java DefaultMethodSecurityExpressionHandler怎么用?Java DefaultMethodSecurityExpressionHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultMethodSecurityExpressionHandler类属于org.springframework.security.access.expression.method包,在下文中一共展示了DefaultMethodSecurityExpressionHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcessAfterInitialization
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
// remove this if you are not using JSR-250
if(bean instanceof Jsr250MethodSecurityMetadataSource) {
((Jsr250MethodSecurityMetadataSource) bean).setDefaultRolePrefix(null);
}
if(bean instanceof DefaultMethodSecurityExpressionHandler) {
((DefaultMethodSecurityExpressionHandler) bean).setDefaultRolePrefix(null);
}
if(bean instanceof DefaultWebSecurityExpressionHandler) {
((DefaultWebSecurityExpressionHandler) bean).setDefaultRolePrefix(null);
}
if(bean instanceof SecurityContextHolderAwareRequestFilter) {
((SecurityContextHolderAwareRequestFilter)bean).setRolePrefix("");
}
if(bean instanceof RoleVoter){
((RoleVoter) bean).setRolePrefix("");
}
return bean;
}
示例2: postProcessAfterInitialization
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
// remove this if you are not using JSR-250
if (bean instanceof Jsr250MethodSecurityMetadataSource) {
((Jsr250MethodSecurityMetadataSource) bean).setDefaultRolePrefix(this.rolePrefix);
}
if (bean instanceof DefaultMethodSecurityExpressionHandler) {
((DefaultMethodSecurityExpressionHandler) bean).setDefaultRolePrefix(this.rolePrefix);
}
if (bean instanceof DefaultWebSecurityExpressionHandler) {
((DefaultWebSecurityExpressionHandler) bean).setDefaultRolePrefix(this.rolePrefix);
}
if (bean instanceof SecurityContextHolderAwareRequestFilter) {
((SecurityContextHolderAwareRequestFilter) bean).setRolePrefix(this.rolePrefix);
}
return bean;
}
示例3: getExpressionHandler
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
private OAuth2MethodSecurityExpressionHandler getExpressionHandler(
DefaultMethodSecurityExpressionHandler bean) {
OAuth2MethodSecurityExpressionHandler handler = new OAuth2MethodSecurityExpressionHandler();
handler.setApplicationContext(this.applicationContext);
AuthenticationTrustResolver trustResolver = findInContext(
AuthenticationTrustResolver.class);
if (trustResolver != null) {
handler.setTrustResolver(trustResolver);
}
PermissionEvaluator permissions = findInContext(PermissionEvaluator.class);
if (permissions != null) {
handler.setPermissionEvaluator(permissions);
}
handler.setExpressionParser(bean.getExpressionParser());
return handler;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:OAuth2MethodSecurityConfiguration.java
示例4: postProcessAfterInitialization
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization( Object bean, String beanName )
throws BeansException
{
if ( bean instanceof Jsr250MethodSecurityMetadataSource )
{
((Jsr250MethodSecurityMetadataSource) bean).setDefaultRolePrefix( null );
}
if ( bean instanceof DefaultMethodSecurityExpressionHandler )
{
((DefaultMethodSecurityExpressionHandler) bean).setDefaultRolePrefix( null );
}
if ( bean instanceof DefaultWebSecurityExpressionHandler )
{
((DefaultWebSecurityExpressionHandler) bean).setDefaultRolePrefix( null );
}
if ( bean instanceof SecurityContextHolderAwareRequestFilter )
{
((SecurityContextHolderAwareRequestFilter) bean).setRolePrefix( "" );
}
return bean;
}
示例5: postProcessAfterInitialization
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization(final Object bean, final String beanName) {
if (bean instanceof DefaultMethodSecurityExpressionHandler) {
((DefaultMethodSecurityExpressionHandler) bean).setDefaultRolePrefix(null);
}
if (bean instanceof DefaultWebSecurityExpressionHandler) {
((DefaultWebSecurityExpressionHandler) bean).setDefaultRolePrefix(null);
}
if (bean instanceof SecurityContextHolderAwareRequestFilter) {
SecurityContextHolderAwareRequestFilter filter = (SecurityContextHolderAwareRequestFilter) bean;
filter.setRolePrefix(StringUtils.EMPTY);
try {
filter.afterPropertiesSet();
} catch (ServletException e) {
throw new FatalBeanException(e.getMessage(), e);
}
}
return bean;
}
示例6: postProcessAfterInitialization
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
// remove this if you are not using JSR-250
if (bean instanceof Jsr250MethodSecurityMetadataSource) {
((Jsr250MethodSecurityMetadataSource) bean).setDefaultRolePrefix(null);
}
if (bean instanceof DefaultMethodSecurityExpressionHandler) {
((DefaultMethodSecurityExpressionHandler) bean).setDefaultRolePrefix(null);
}
if (bean instanceof DefaultWebSecurityExpressionHandler) {
((DefaultWebSecurityExpressionHandler) bean).setDefaultRolePrefix(null);
}
if (bean instanceof SecurityContextHolderAwareRequestFilter) {
((SecurityContextHolderAwareRequestFilter) bean).setRolePrefix("");
}
return bean;
}
示例7: postProcessAfterInitialization
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
if (bean instanceof DefaultMethodSecurityExpressionHandler
&& !(bean instanceof OAuth2MethodSecurityExpressionHandler)) {
return getExpressionHandler(
(DefaultMethodSecurityExpressionHandler) bean);
}
return bean;
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:11,代码来源:OAuth2MethodSecurityConfiguration.java
示例8: getExpressionHandler
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
private OAuth2MethodSecurityExpressionHandler getExpressionHandler(
DefaultMethodSecurityExpressionHandler bean) {
OAuth2MethodSecurityExpressionHandler handler = new OAuth2MethodSecurityExpressionHandler();
handler.setApplicationContext(this.applicationContext);
AuthenticationTrustResolver trustResolver = findInContext(
AuthenticationTrustResolver.class);
if (trustResolver != null) {
handler.setTrustResolver(trustResolver);
}
handler.setExpressionParser(bean.getExpressionParser());
return handler;
}
开发者ID:spring-projects,项目名称:spring-security-oauth2-boot,代码行数:13,代码来源:OAuth2MethodSecurityConfiguration.java
示例9: expressionHandler
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Bean
public DefaultMethodSecurityExpressionHandler expressionHandler(){
DefaultMethodSecurityExpressionHandler dmseh = new DefaultMethodSecurityExpressionHandler();
dmseh.setPermissionEvaluator(permissionEvaluator());
dmseh.setPermissionCacheOptimizer(permissionCacheOptimizer());
return dmseh;
}
示例10: defaultExpressionHandler
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Description("DefaultMethodSecurityExpressionHandler")
@Bean
public DefaultMethodSecurityExpressionHandler defaultExpressionHandler(EventDao eventDao){
DefaultMethodSecurityExpressionHandler deh = new DefaultMethodSecurityExpressionHandler();
deh.setPermissionEvaluator(
new CalendarPermissionEvaluator(eventDao));
return deh;
}
示例11: createExpressionHandler
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
protected MethodSecurityExpressionHandler createExpressionHandler() {
DefaultMethodSecurityExpressionHandler expressionHandler =
new DefaultMethodSecurityExpressionHandler();
expressionHandler.setPermissionEvaluator(platformPermissionEvaluator);
return expressionHandler;
}
示例12: createExpressionHandler
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
protected MethodSecurityExpressionHandler createExpressionHandler() {
DefaultMethodSecurityExpressionHandler expressionHandler = new DefaultMethodSecurityExpressionHandler();
// expressionHandler.setPermissionEvaluator(permissionEvaluator());
expressionHandler.setRoleHierarchy(roleHierarchy());
return expressionHandler;
}
示例13: isAccessGranted
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
public boolean isAccessGranted(String beanName, UI ui) {
final PreAuthorize viewSecured = applicationContext.findAnnotationOnBean(beanName, PreAuthorize.class);
if (viewSecured != null) {
final Class<?> targetClass = AopUtils.getTargetClass(applicationContext.getBean(beanName));
final Method method = ClassUtils.getMethod(AopUtils.getTargetClass(applicationContext.getBean(beanName)), "enter", com.vaadin.navigator.ViewChangeListener.ViewChangeEvent.class);
final MethodInvocation methodInvocation = MethodInvocationUtils.createFromClass(targetClass, method.getName());
final Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
final AccessDecisionManager accessDecisionManager = applicationContext.getBean(AccessDecisionManager.class);
final ExpressionBasedAnnotationAttributeFactory attributeFactory = new ExpressionBasedAnnotationAttributeFactory(new DefaultMethodSecurityExpressionHandler());
Collection<ConfigAttribute> atributi = new ArrayList<ConfigAttribute>();
atributi.add(attributeFactory.createPreInvocationAttribute(null, null, viewSecured.value()));
try {
accessDecisionManager.decide(authentication, methodInvocation, atributi);
return true;
} catch (AccessDeniedException | InsufficientAuthenticationException ex) {
return false;
}
} else {
return true;
}
}
开发者ID:markoradinovic,项目名称:Vaadin4Spring-MVP-Sample-SpringSecurity,代码行数:31,代码来源:PreAuthorizeSpringViewProviderAccessDelegate.java
示例14: createExpressionHandler
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
/**
* This is needed so {@link org.springframework.security.access.prepost.PreAuthorize} and so on know the role hierarchy.
*/
@Override
protected MethodSecurityExpressionHandler createExpressionHandler() {
DefaultMethodSecurityExpressionHandler methodSecurityExpressionHandler = new DefaultMethodSecurityExpressionHandler();
methodSecurityExpressionHandler.setRoleHierarchy(roleHierarchy);
//Needs to be done so we can access beans in security expressions
methodSecurityExpressionHandler.setApplicationContext(applicationContext);
return methodSecurityExpressionHandler;
}
示例15: createExpressionHandler
import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
protected MethodSecurityExpressionHandler createExpressionHandler() {
final DefaultMethodSecurityExpressionHandler expressionHandler =
new DefaultMethodSecurityExpressionHandler();
expressionHandler.setPermissionEvaluator(permissionEvaluator);
expressionHandler.setApplicationContext(applicationContext);
return expressionHandler;
}