Spring 云的 XACML

XACML for Spring Cloud

我将使用 OAuth2 和 XACML(使用 AuthZForce、Balana、AT&T XACML 或类似的东西)保护我的 Spring 云应用程序。

我想使用来自 Spring-Cloud(-Netflix) 的微服务。为了使 XACML 可用,我认为我需要这个:

  1. 每个现有 API-服务的 PEP
  2. PDP 作为新服务,由 PEP 使用。因为 Spring-Cloud(-Netflix) 具有负载平衡功能 (Eureka) 我需要在 Eureka 上注册此服务并实现 REST-API.
  3. 因为所有 PDP 都应该使用相同的策略,所以它们需要集中存储(策略提供者)

哪个框架最适合这种方法。

更新 1 AuthZForce应该可以(根据功能描述),但我不太确定如何(没有详细的文档或教程)。

我不是很了解所有的框架,所以我无法objective回答哪个框架最合适。但是我可以给AuthzForce一个答案。

对于PDP部分,可以使用AuthzForce Core as Java library. The wiki gives information about Policy Providers and how to add your own to the framework if necessary. There is one mentioned there that gets policies from a MongoDB database. Note that if you want PDPs to use the same policies, a central storage is one solution, but another is to use replication/synchronization. For example, if you use the Policy Provider that supports getting policies on the local filesystem, a decentralized cluster synchronization tool like csync2可以做到没有单点故障。

此外,您可能对AuthzForce Server which provides a multi-tenant REST API for both PDP and PAP (policy administration) in compliance with XACML REST profile(PDP 部分)感兴趣。如果您只需要 PDP,这可能有点矫枉过正,但如果您的要求朝这个方向发展,它可能值得一看。

对于 PEP 部分,您可以重用 Maven Central (groupId=org.ow2.authzforce, artifactId=authzforce-ce-xacml-model) 上可用的 authzforce-ce-xacml-model(和依赖项)来操作XACML Requests/Responses 与您的 PDP 的 REST API 进行了交换。这主要包含从 XACML 模式派生的所有 JAXB 注释 类,以及标准 XACML 标识符的枚举:类别、属性、数据类型等。