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


Java RoleVoter.setRolePrefix方法代码示例

本文整理汇总了Java中org.springframework.security.access.vote.RoleVoter.setRolePrefix方法的典型用法代码示例。如果您正苦于以下问题:Java RoleVoter.setRolePrefix方法的具体用法?Java RoleVoter.setRolePrefix怎么用?Java RoleVoter.setRolePrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.security.access.vote.RoleVoter的用法示例。


在下文中一共展示了RoleVoter.setRolePrefix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shellAccessDecisionManager

import org.springframework.security.access.vote.RoleVoter; //导入方法依赖的package包/类
@Bean
public AccessDecisionManager shellAccessDecisionManager() {
	List<AccessDecisionVoter<?>> voters = new ArrayList<AccessDecisionVoter<?>>();
	RoleVoter voter = new RoleVoter();
	voter.setRolePrefix("");
	voters.add(voter);
	return new UnanimousBased(voters);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:CrshAutoConfigurationTests.java

示例2: accessDecisionManager

import org.springframework.security.access.vote.RoleVoter; //导入方法依赖的package包/类
/**
 * Overridden to remove role prefix for the role voter. The application does not require any other access decision voters in the default configuration.
 */
/*
 * rawtypes must be suppressed because AffirmativeBased constructor takes in a raw typed list of AccessDecisionVoters
 */
@SuppressWarnings("rawtypes")
@Override
protected AccessDecisionManager accessDecisionManager()
{
    List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<>();
    RoleVoter decisionVoter = new RoleVoter();
    decisionVoter.setRolePrefix("");
    decisionVoters.add(decisionVoter);
    return new AffirmativeBased(decisionVoters);
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:17,代码来源:AppSpringModuleConfig.java

示例3: addFilterSecurityInterceptor

import org.springframework.security.access.vote.RoleVoter; //导入方法依赖的package包/类
private void addFilterSecurityInterceptor(List<Filter> filters, MotechURLSecurityRule securityRule) {
    Map<RequestMatcher, Collection<ConfigAttribute>> requestMap = new LinkedHashMap<>();

    List<AccessDecisionVoter> voters = new ArrayList<>();
    Collection<ConfigAttribute> configAtts = new ArrayList<>();

    if (CollectionUtils.isEmpty(securityRule.getPermissionAccess()) && CollectionUtils.isEmpty(securityRule.getUserAccess())) {
        configAtts.add(new SecurityConfig("IS_AUTHENTICATED_FULLY"));
        AuthenticatedVoter authVoter = new AuthenticatedVoter();
        voters.add(authVoter);
    } else {
        if (!CollectionUtils.isEmpty(securityRule.getPermissionAccess())) {
            for (String permission : securityRule.getPermissionAccess()) {
                configAtts.add(new SecurityConfig(permission));
            }
        }
        if (!CollectionUtils.isEmpty(securityRule.getUserAccess())) {
            for (String userAccess : securityRule.getUserAccess()) {
                configAtts.add(new SecurityConfig(SecurityConfigConstants.USER_ACCESS_PREFIX + userAccess));
            }
        }
    }

    buildRequestMap(requestMap, configAtts, securityRule);

    FilterInvocationSecurityMetadataSource metadataSource = new DefaultFilterInvocationSecurityMetadataSource((LinkedHashMap<RequestMatcher, Collection<ConfigAttribute>>) requestMap);

    FilterSecurityInterceptor interceptor = new FilterSecurityInterceptor();
    interceptor.setSecurityMetadataSource(metadataSource);

    RoleVoter roleVoter = new RoleVoter();

    roleVoter.setRolePrefix(SecurityConfigConstants.ROLE_ACCESS_PREFIX);
    voters.add(roleVoter);

    voters.add(new MotechAccessVoter());

    AccessDecisionManager decisionManager = new AffirmativeBased(voters);

    interceptor.setAccessDecisionManager(decisionManager);
    interceptor.setAuthenticationManager(authenticationManager);

    filters.add(interceptor);
}
 
开发者ID:motech,项目名称:motech,代码行数:45,代码来源:SecurityRuleBuilder.java

示例4: getRoleVoter

import org.springframework.security.access.vote.RoleVoter; //导入方法依赖的package包/类
@Bean
public RoleVoter getRoleVoter() {
    RoleVoter roleVoter = new RoleVoter();
    roleVoter.setRolePrefix("ROLE _");
    return roleVoter;
}
 
开发者ID:jacek99,项目名称:dropwizard-spring-di-security-onejar-example,代码行数:7,代码来源:MyAppSpringConfiguration.java


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