当前位置: 首页>>代码示例>>Java>>正文


Java DefaultMethodSecurityExpressionHandler类代码示例

本文整理汇总了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;
}
 
开发者ID:zzqfsy,项目名称:spring-jwt-starter,代码行数:24,代码来源:DefaultRolesPrefixPostProcessor.java

示例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;
}
 
开发者ID:oasp,项目名称:oasp-tutorial-sources,代码行数:20,代码来源:DefaultRolesPrefixPostProcessor.java

示例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;
}
 
开发者ID:dhis2,项目名称:dhis2-core,代码行数:27,代码来源:DefaultRolesPrefixPostProcessor.java

示例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;
}
 
开发者ID:apache,项目名称:syncope,代码行数:21,代码来源:DefaultRolesPrefixPostProcessor.java

示例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;
}
 
开发者ID:jpaoletti,项目名称:java-presentation-manager-2,代码行数:19,代码来源:DefaultRolesPrefixPostProcessor.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:9,代码来源:AclConfig.java

示例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;
}
 
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:9,代码来源:CustomAuthorizationConfig.java

示例11: createExpressionHandler

import org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler; //导入依赖的package包/类
@Override
protected MethodSecurityExpressionHandler createExpressionHandler() {
    DefaultMethodSecurityExpressionHandler expressionHandler =
            new DefaultMethodSecurityExpressionHandler();
    expressionHandler.setPermissionEvaluator(platformPermissionEvaluator);
    return expressionHandler;
}
 
开发者ID:abixen,项目名称:abixen-platform,代码行数:8,代码来源:PlatformGlobalMethodSecurityConfiguration.java

示例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;
}
 
开发者ID:jgribonvald,项目名称:demo-spring-security-cas,代码行数:8,代码来源:MethodSecurityConfig.java

示例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;
}
 
开发者ID:techdev-solutions,项目名称:spring-test-example,代码行数:13,代码来源:MethodSecurityConfiguration.java

示例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;
}
 
开发者ID:kTT,项目名称:adjule,代码行数:9,代码来源:MethodSecurityConfig.java


注:本文中的org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。