本文整理汇总了Java中org.springframework.security.access.AccessDecisionManager类的典型用法代码示例。如果您正苦于以下问题:Java AccessDecisionManager类的具体用法?Java AccessDecisionManager怎么用?Java AccessDecisionManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AccessDecisionManager类属于org.springframework.security.access包,在下文中一共展示了AccessDecisionManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:devacfr,项目名称:spring-restlet,代码行数:21,代码来源:RestletSpringApplication.java
示例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);
}
开发者ID:melthaw,项目名称:spring-backend-boilerplate,代码行数:9,代码来源:OpenApiSecurityConfigurer.java
示例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();
}
开发者ID:c2mon,项目名称:c2mon-web-ui,代码行数:16,代码来源:WebSecurityConfig.java
示例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();
}
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:12,代码来源:UsersStorage.java
示例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;
}
开发者ID:dhis2,项目名称:dhis2-core,代码行数:14,代码来源:LogicalOrAccessDecisionManager.java
示例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);
}
开发者ID:FINRAOS,项目名称:herd,代码行数:17,代码来源:AppSpringModuleConfig.java
示例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);
}
开发者ID:trustedanalytics,项目名称:user-management,代码行数:13,代码来源:MockedSecurityInterceptor.java
示例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);
}
开发者ID:coverity,项目名称:pie,代码行数:10,代码来源:PieMethodSecurityConfig.java
示例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);
}
开发者ID:wayshall,项目名称:onetwo,代码行数:8,代码来源:UrlBasedSecurityConfig.java
示例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;
}
开发者ID:wayshall,项目名称:onetwo,代码行数:12,代码来源:MethodBasedSecurityConfig.java
示例16: defaultSecurityConfigurer
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Bean
@Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
@ConditionalOnMissingBean(DefaultUrlSecurityConfigurer.class)
@Autowired
public DefaultUrlSecurityConfigurer defaultSecurityConfigurer(AccessDecisionManager accessDecisionManager){
return super.defaultSecurityConfigurer(accessDecisionManager);
}
开发者ID:wayshall,项目名称:onetwo,代码行数:8,代码来源:BootUrlBasedSecurityConfig.java
示例17: accessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Override
protected AccessDecisionManager accessDecisionManager () {
List<AccessDecisionVoter<?>> decisionVoters = new ArrayList<> ();
ExpressionBasedPreInvocationAdvice expressionAdvice = new ExpressionBasedPreInvocationAdvice();
expressionAdvice.setExpressionHandler(getExpressionHandler());
decisionVoters.add(roleVoter ());
decisionVoters.add(new AuthenticatedVoter ());
return new AffirmativeBased (decisionVoters);
}
开发者ID:andifalk,项目名称:spring-security-workshop,代码行数:10,代码来源:SecurityConfiguration.java
示例18: isAccessGranted
import org.springframework.security.access.AccessDecisionManager; //导入依赖的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
示例19: create
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public static HandlerSecurityInterceptor create() {
HandlerSecurityInterceptor interceptor = new HandlerSecurityInterceptor();
WebExpressionVoterAdapter voter = new WebExpressionVoterAdapter(new WebExpressionVoter());
AccessDecisionManager accessDecisionManager = new AffirmativeBased(Arrays.<AccessDecisionVoter> asList(voter));
interceptor.setAccessDecisionManager(accessDecisionManager);
interceptor.setSecurityMetadataSource(new ExpressionBasedHandlerInvocationSecurityMetadataSource());
return interceptor;
}
开发者ID:mateuszwenus,项目名称:spring-security-controller-auth,代码行数:10,代码来源:HandlerSecurityInterceptor.java
示例20: setAccessDecisionManager
import org.springframework.security.access.AccessDecisionManager; //导入依赖的package包/类
@Autowired
@Override
public void setAccessDecisionManager(AccessDecisionManager accessDecisionManager) {
super.setAccessDecisionManager(accessDecisionManager);
}
开发者ID:jeikerxiao,项目名称:SpringBootStudy,代码行数:6,代码来源:DemoSecurityInterceptor.java
注:本文中的org.springframework.security.access.AccessDecisionManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论