當前位置: 首頁>>代碼示例>>Java>>正文


Java AccessDecisionManager類代碼示例

本文整理匯總了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;

}
 
開發者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


注:本文中的org.springframework.security.access.AccessDecisionManager類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。