本文整理汇总了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);
}
示例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);
}
示例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