本文整理汇总了Java中org.springframework.security.access.AccessDecisionManager类的典型用法代码示例。如果您正苦于以下问题:Java AccessDecisionManager类的具体用法?Java AccessDecisionManager怎么用?Java AccessDecisionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccessDecisionManager类属于org.springframework.security.access包,在下文中一共展示了AccessDecisionManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSecurityGuard
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
protected Guard createSecurityGuard() {
ApplicationContext context = getApplicationContext();
AccessDecisionManager accessDecisionManager = context.getBean(AccessDecisionManager.class);
WebInvocationPrivilegeEvaluator invocationPrivilegeEvaluator = context
.getBean(WebInvocationPrivilegeEvaluator.class);
if (accessDecisionManager == null || invocationPrivilegeEvaluator == null) {
return null;
}
SpringSecurityGuard springSecurityGuard = new SpringSecurityGuard();
springSecurityGuard.setApplicationContext(context);
springSecurityGuard.setAccessDecisionManager(accessDecisionManager);
springSecurityGuard.setInvocationPrivilegeEvaluator(invocationPrivilegeEvaluator);
try {
springSecurityGuard.afterPropertiesSet();
} catch (Exception e) {
throw new RuntimeException("Error initialization security Guard", e);
}
return springSecurityGuard;
}
示例2: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Bean
public AccessDecisionManager accessDecisionManager() {
List<AccessDecisionVoter<? extends Object>> decisionVoters = new ArrayList<>();
decisionVoters.add(new RoleVoter());
decisionVoters.add(new AuthenticatedVoter());
decisionVoters.add(webExpressionVoter());
return new AffirmativeBased(decisionVoters);
}
示例3: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Description("ConsensusBased AccessDecisionManager for Authorization voting")
@Bean
public AccessDecisionManager accessDecisionManager(
CustomWebSecurityExpressionHandler customWebSecurityExpressionHandler) {
List<AccessDecisionVoter<? extends Object>> decisionVoters
= Arrays.asList(
// new AuthenticatedVoter(),
// new RoleVoter(),
new WebExpressionVoter(){{
setExpressionHandler(customWebSecurityExpressionHandler);
}}
);
return new ConsensusBased(decisionVoters);
}
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:15,代码来源:CustomAuthorizationConfig.java
示例4: accessDecisionManager2
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
public AccessDecisionManager accessDecisionManager2(
CustomWebSecurityExpressionHandler customWebSecurityExpressionHandler) {
List<AccessDecisionVoter<? extends Object>> decisionVoters
= Arrays.asList(
new AuthenticatedVoter(),
new RoleVoter(),
new WebExpressionVoter(){{
setExpressionHandler(customWebSecurityExpressionHandler);
}}
);
return new UnanimousBased(decisionVoters);
}
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:13,代码来源:CustomAuthorizationConfig.java
示例5: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Description("AccessDecisionManager for Authorization voting")
@Bean
public AccessDecisionManager accessDecisionManager(
CustomWebSecurityExpressionHandler customWebSecurityExpressionHandler) {
List<AccessDecisionVoter<? extends Object>> decisionVoters
= Arrays.asList(
new WebExpressionVoter(){{
setExpressionHandler(customWebSecurityExpressionHandler);
}}
);
return new ConsensusBased(decisionVoters);
}
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:13,代码来源:CustomAuthorizationConfig.java
示例6: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Description("ConsensusBased AccessDecisionManager for Authorization voting")
@Bean
public AccessDecisionManager accessDecisionManager(
CustomWebSecurityExpressionHandler customWebSecurityExpressionHandler) {
List<AccessDecisionVoter<? extends Object>> decisionVoters
= Arrays.asList(
new WebExpressionVoter(){{
setExpressionHandler(customWebSecurityExpressionHandler);
}}
);
return new ConsensusBased(decisionVoters);
}
开发者ID:PacktPublishing,项目名称:Spring-Security-Third-Edition,代码行数:13,代码来源:CustomAuthorizationConfig.java
示例7: shellAccessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的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
示例8: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Bean
public AccessDecisionManager accessDecisionManager() {
if (properties.isSecurityEnabled() && sessionService() != null) {
Map<String, String> authorisationDetails = new HashMap<>();
authorisationDetails.put("configloader/progress", environment.getProperty("c2mon.web.rbac.admin"));
// Allow show charts without login
authorisationDetails.put("commandviewer", environment.getProperty("c2mon.web.rbac.user"));
log.info("Using RbacDecisionManager");
return new RbacDecisionManager(sessionService(), authorisationDetails);
}
log.info("Using DefaultAccessDecisionManager");
return new DefaultAccessDecisionManager();
}
示例9: UsersStorage
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Autowired
public UsersStorage(KvMapperFactory mapperFactory, AccessDecisionManager accessDecisionManager) {
this.adm = accessDecisionManager;
String prefix = KvUtils.join(mapperFactory.getStorage().getPrefix(), "users");
this.map = KvMap.builder(UserRegistration.class, ExtendedUserDetailsImpl.class)
.mapper(mapperFactory)
.path(prefix)
.passDirty(true)
.adapter(new KvMapAdapterImpl())
.build();
}
示例10: supports
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Override
public boolean supports( ConfigAttribute configAttribute )
{
for ( AccessDecisionManager accessDecisionManager : accessDecisionManagers )
{
if ( accessDecisionManager.supports( configAttribute ) )
{
return true;
}
}
return false;
}
示例11: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的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);
}
示例12: MockedSecurityInterceptor
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
public MockedSecurityInterceptor() {
this.setAuthenticationManager(authentication -> null);
AccessDecisionManager accessDecisionManager = mock(AccessDecisionManager.class);
doReturn(true).when(accessDecisionManager).supports(any(Class.class));
this.setAccessDecisionManager(accessDecisionManager);
FilterInvocationSecurityMetadataSource filterInvocationSecurityMetadataSource =
mock(FilterInvocationSecurityMetadataSource.class);
doReturn(true).when(filterInvocationSecurityMetadataSource).supports(any(Class.class));
this.setSecurityMetadataSource(filterInvocationSecurityMetadataSource);
}
示例13: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Override
protected AccessDecisionManager accessDecisionManager() {
final SpringSecurityPolicyEnforcer policyEnforcer = (SpringSecurityPolicyEnforcer)servletContext.getAttribute(SpringSecurityPolicyEnforcer.SPRING_SECURITY_POLICY_ATTRIBUTE);
if (policyEnforcer == null) {
throw new IllegalStateException("Spring policy enforcer wasn't initialized.");
}
return new PieAccessDecisionManager(policyEnforcer);
}
示例14: defaultSecurityConfigurer
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Bean
// @Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
// @ConditionalOnMissingBean(WebSecurityConfigurerAdapter.class)
@Autowired
public DefaultUrlSecurityConfigurer defaultSecurityConfigurer(AccessDecisionManager accessDecisionManager){
return new DefaultUrlSecurityConfigurer(accessDecisionManager);
}
示例15: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
/***
* 对应的方法决策器
*/
@Override
protected AccessDecisionManager accessDecisionManager() {
AccessDecisionManager decisionManager = super.accessDecisionManager();
@SuppressWarnings("unchecked")
List<AccessDecisionVoter<? extends Object>> decisionVoters = (List<AccessDecisionVoter<? extends Object>>)ReflectUtils.getFieldValue(decisionManager, "decisionVoters");
decisionVoters.add(new MethodWebExpressionVoter());
return decisionManager;
}