42. Spring 安全性依赖

本附录提供了 Spring Security 中的模块以及它们在运行中的应用程序中运行所需的其他依赖项的参考。我们不包括仅在构建或测试 Spring Security 本身时使用的依赖项。我们也没有包括外部依赖项所要求的传递性依赖项。

项目网站上列出了所需的 Spring 版本,因此下面的 Spring 依赖项省略了特定版本。请注意,Spring 应用程序中的其他非安全功能可能仍需要下面列出为“可选”的某些依赖项。此外,如果大多数应用程序中都使用了列为“可选”的依赖项,则在项目的 Maven POM 文件中可能实际上并未将其标记为此类依赖项。除非您使用指定的功能,否则它们仅在不需要它们的意义上是“可选的”。

在模块依赖于另一个 Spring Security 模块的情况下,也假定该模块所依赖的模块的非可选依赖关系是必需的,因此未单独列出。

42.1 spring-security-core

使用 Spring Security 的任何项目中都必须包含核心模块。

表 42.1. 核心依赖

DependencyVersionDescription
aopalliance1.0方法安全性实现必需。
ehcache1.6.2如果使用基于 Ehcache 的用户缓存实现,则为必需(可选)。
spring-aop 方法安全性基于 Spring AOP
spring-beans Spring 配置必需
spring-expression 基于表达式的方法安全性必需(可选)
spring-jdbc 如果使用数据库存储用户数据,则为必需(可选)。
spring-tx 如果使用数据库存储用户数据,则为必需(可选)。
aspectjrt1.6.10如果使用 AspectJ 支持,则为必需(可选)。
jsr250-api1.0如果您使用的是 JSR-250 方法安全性 Comments(可选),则为必需。

42.2 spring-security-remoting

使用 Servlet API 的 Web 应用程序通常需要此模块。

表 42.2. 远程依赖

DependencyVersionDescription
spring-security-core
spring-web 使用 HTTP 远程支持的 Client 端需要。

42.3 spring-security-web

使用 Servlet API 的 Web 应用程序通常需要此模块。

表 42.3. 网络依赖

DependencyVersionDescription
spring-security-core
spring-web Spring Web 支持类被广泛使用。
spring-jdbc 对于基于 JDBC 的永久性“记住我”令牌存储库是必需的(可选)。
spring-tx “记住我”持久令牌存储库实现必需(可选)。

42.4 spring-security-ldap

仅在使用 LDAP 身份验证时才需要此模块。

表 42.4. LDAP 依赖关系

DependencyVersionDescription
spring-security-core
spring-ldap-core1.3.0LDAP 支持基于 Spring LDAP。
spring-tx 数据异常类是必需的。
apache-ds [1]1.5.5如果您使用嵌入式 LDAP 服务器(可选),则为必需。
shared-ldap0.9.15如果您使用嵌入式 LDAP 服务器(可选),则为必需。
ldapsdk4.1Mozilla LdapSDK。例如,如果您在 OpenLDAP 中使用密码策略功能,则用于解码 LDAP 密码策略控件。
[1]需要模块apacheds-coreapacheds-core-entryapacheds-protocol-sharedapacheds-protocol-ldapapacheds-server-jndi

42.5 spring-security-config

如果您使用的是 Spring Security 名称空间配置,那么此模块是必需的。

表 42.5. 配置依赖项

DependencyVersionDescription
spring-security-core
spring-security-web 如果使用任何与 Web 相关的名称空间配置,则为必需(可选)。
spring-security-ldap 如果使用 LDAP 名称空间选项(可选),则为必需。
spring-security-openid 如果使用的是 OpenID 身份验证,则为必需(可选)。
aspectjweaver1.6.10如果使用 protect-pointcut 名称空间语法(必需),则为必需。

42.6 spring-security-acl

ACL 模块。

表 42.6. ACL 依赖项

DependencyVersionDescription
spring-security-core
ehcache1.6.2如果使用基于 Ehcache 的 ACL 缓存实现,则为必需(如果使用自己的实现,则为可选)。
spring-jdbc 如果使用的是默认的基于 JDBC 的 AclService,则为必需(如果实现自己的,则为可选)。
spring-tx 如果使用的是默认的基于 JDBC 的 AclService,则为必需(如果实现自己的,则为可选)。

42.7 spring-security-cas

CAS 模块提供与 JA-SIG CAS 的集成。

表 42.7. CAS 依赖性

DependencyVersionDescription
spring-security-core
spring-security-web
cas-client-core3.1.12JA-SIG CAS Client 端。这是 Spring Security 集成的基础。
ehcache1.6.2如果您正在使用基于 Ehcache 的票证缓存(可选),则为必需。

42.8 spring-security-openid

OpenID 模块。

表 42.8. OpenID 依赖项

DependencyVersionDescription
spring-security-core
spring-security-web
openid4java-nodeps0.9.6Spring Security 的 OpenID 集成使用 OpenID4Java。
httpclient4.1.1openid4java-nodeps 取决于 HttpClient 4.
guice2.0openid4java-nodeps 取决于 Guice 2.

42.9 spring-security-taglibs

提供 Spring Security 的 JSP 标签实现。

表 42.9. Taglib 依赖项

DependencyVersionDescription
spring-security-core
spring-security-web
spring-security-acl 如果您将accesscontrollist标记或hasPermission()表达式与 ACL 一起使用,则为必填项(可选)。
spring-expression 如果在标记访问约束中使用 SPEL 表达式,则为必需。