1. 程式人生 > 實用技巧 >42. Spring Security Dependencies春季安全依賴

42. Spring Security Dependencies春季安全依賴

本附錄提供了Spring Security中模組的參考,以及它們在執行的應用程式中執行所需的附加依賴關係。我們不包括僅在構建或測試Spring Security本身時使用的依賴關係。我們也不包括外部依賴所需的可傳遞依賴。

專案網站上列出了所需的Spring版本,因此下面的Spring依賴項省略了具體的版本。請注意,下面作為“可選”列出的一些依賴項對於Spring應用程式中的其他非安全功能可能仍然是必需的。此外,如果在大多數應用程式中使用,在專案的Maven POM檔案中,被列為“可選”的依賴項實際上可能不會被標記為“可選”。它們只是在你不需要它們的意義上是“可選的”,除非你正在使用指定的功能。

當一個模組依賴於另一個Spring Security模組時,它所依賴的模組的非可選依賴項也被認為是必需的,並且沒有單獨列出。

42.1spring-security-core彈簧-安全-核心

核心模組必須包含在任何使用Spring Security的專案中。

Table42.1.Core Dependencie

DependencyVersionDescription

aopalliance

1.0

Required for method security implementation.方法安全實現所需的。

ehcache

1.6.2

Required if the Ehcache-based user cache implementation is used (optional).如果使用基於Ehcache的使用者快取實現,則為必填項(可選)。

spring-aop

Method security is based on Spring AOP方法安全性基於Spring AOP

spring-beans

Required for Spring configuration彈簧配置需要

spring-expression

Required for expression-based method security (optional)基於表示式的方法安全性必需(可選)

spring-jdbc

Required if using a database to store user data (optional).如果使用資料庫儲存使用者資料,則為必填項(可選)。 spring-tx

spring-tx

Required if using a database to store user data (optional).如果使用資料庫儲存使用者資料,則為必填項(可選)。

aspectjrt

1.6.10

Required if using AspectJ support (optional).如果使用AspectJ支援,則為必填項(可選)。

jsr250-api

1.0

Required if you are using JSR-250 method-security annotations (optional).如果您使用的是JSR-250方法-安全註釋,則此選項為必填項(可選)。

42.2spring-security-remotingspring-security-遠端處理

這個模組通常在使用Servlet應用程式設計介面的網路應用程式中是必需的。

Table42.2.Remoting Dependencies

DependencyVersionDescription

spring-security-core

spring-web

Required for clients which use HTTP remoting support.對於使用超文字傳輸協議遠端處理支援的客戶端是必需的。

42.3spring-security-web彈簧-安全-網

這個模組通常在使用Servlet應用程式設計介面的網路應用程式中是必需的。

Table42.3.Web Dependencies

DependencyVersionDescription

spring-security-core

spring-web

Spring web support classes are used extensively.Spring web支援類被廣泛使用。

spring-jdbc

Required for JDBC-based persistent remember-me token repository (optional).對於基於JDBC的永久記憶令牌庫是必需的(可選)。

spring-tx

Required by remember-me persistent token repository implementations (optional).“記住我”永久令牌儲存庫實現需要(可選)。

42.4spring-security-ldap

僅當您使用LDAP身份驗證時,此模組才是必需的。

Table42.4.LDAP Dependencies

DependencyVersionDescription

spring-security-core

spring-ldap-core

1.3.0

LDAP support is based on Spring LDAP.LDAP支援基於春季LDAP。

spring-tx

Data exception classes are required.需要資料異常類。

apache-ds[1]

1.5.5

Required if you are using an embedded LDAP server (optional).如果您使用的是嵌入式LDAP伺服器,則需要此項(可選)。

shared-ldap

0.9.15

Required if you are using an embedded LDAP server (optional).如果您使用的是嵌入式LDAP伺服器,則需要此項(可選)。 ldapsdk

ldapsdk

4.1

Mozilla LdapSDK. Used for decoding LDAP password policy controls if you are using password-policy functionality withMozilla LdapSDK。如果將密碼策略功能與一起使用,則用於解碼LDAP密碼策略控制元件

42.5spring-security-config彈簧-安全-配置

如果您使用的是Spring Security名稱空間配置,則此模組是必需的。

Table42.5.Config Dependencies

DependencyVersionDescription

spring-security-core

spring-security-web

Required if you are using any web-related namespace configuration (optional).如果您正在使用任何與web相關的名稱空間配置,則需要此選項(可選)。

spring-security-ldap

Required if you are using the LDAP namespace options (optional).如果您使用的是LDAP名稱空間選項,則為必填項(可選)。

spring-security-openid

Required if you are using OpenID authentication (optional).如果您使用的是OpenID身份驗證,則為必填項(可選)。

aspectjweaver

1.6.10

Required if using the protect-pointcut namespace syntax (optional).如果使用保護切入點名稱空間語法,則為必填項(可選)。

42.6spring-security-acl

The ACL module.

Table42.6.ACL Dependencies

DependencyVersionDescription

spring-security-core

ehcache

1.6.2

Required if the Ehcache-based ACL cache implementation is used (optional if you are using your own implementation).如果使用基於Ehcache的ACL快取實現,則為必需(如果使用自己的實現,則為可選)。

spring-jdbc

Required if you are using the default JDBC-based AclService (optional if you implement your own).如果您使用預設的基於JDBC的AclService,則為必填項(如果您實現自己的AClServiCe,則為可選項)。

spring-tx

Required if you are using the default JDBC-based AclService (optional if you implement your own).如果您使用預設的基於JDBC的AclService,則為必填項(如果您實現自己的AClServiCe,則為可選項)。

42.7spring-security-cas

CAS模組提供了與JA-SIG CAS的整合。

Table42.7.CAS Dependencies

DependencyVersionDescription

spring-security-core

spring-security-web

cas-client-core

3.1.12

The JA-SIG CAS Client. This is the basis of the Spring Security integration.

ehcache

1.6.2

Required if you are using the Ehcache-based ticket cache (optional).

Table42.7.CAS Dependencies

DependencyVersionDescription

spring-security-core

spring-security-web

cas-client-core

3.1.12

The JA-SIG CAS Client. This is the basis of the Spring Security integration.

ehcache

1.6.2

Required if you are using the Ehcache-based ticket cache (optional).

42.8spring-security-openid

The OpenID module.

Table42.8.OpenID Dependencies

DependencyVersionDescription

spring-security-core

spring-security-web

openid4java-nodeps

0.9.6

Spring Security’s OpenID integration uses OpenID4Java.Spring Security的OpenID整合使用了OpenID4Java。

httpclient

4.1.1

openid4java-nodeps depends on HttpClient 4.openid4java-nodeps依賴於HttpClient 4。

guice

2.0

openid4java-nodeps depends on Guice 2.openid4java-nodeps依賴Guice 2。

42.9spring-security-taglibs

42.9spring-security-taglibs

提供了Spring Security的JSP標籤實現。

Table42.9.Taglib Dependencies

DependencyVersionDescription

spring-security-core

spring-security-web

spring-security-acl

Required if you are using theaccesscontrollisttag orhasPermission()expressions with ACLs (optional).如果您將accesscontrollist標記或hasPermission()表示式與ACLs一起使用,則需要此選項(可選)。

spring-expression

Required if you are using SPEL expressions in your tag access constraints.

Provides Spring Security’s JSP tag implementations.

Table42.9.Taglib Dependencies

DependencyVersionDescription

spring-security-core

spring-security-web

spring-security-acl

Required if you are using theaccesscontrollisttag orhasPermission()expressions with ACLs (optional).如果您將accesscontrollist標記或hasPermission()表示式與ACLs一起使用,則需要此選項(可選)。

spring-expression

Required if you are using SPEL expressions in your tag access constraints.如果在標記訪問約束中使用SPEL表示式,則需要此選項。

43.Proxy Server Configuration

使用代理伺服器時,確保正確配置應用程式非常重要。例如,許多應用程式都有一個負載平衡器,該負載平衡器通過將請求轉發到位於https://192.168.1:8080的應用程式伺服器來響應對https://example.com/的請求。如果沒有正確的配置,應用程式伺服器將不會知道負載平衡器的存在,並且會將該請求視為客戶端請求了https://192.168.1:8080。

要解決這個問題,您可以使用RFC 7239來指定正在使用負載平衡器。要讓應用程式意識到這一點,您需要配置您的應用程式伺服器,使其意識到X-Forward頭。例如,Tomcat使用遠端閥門,Jetty使用轉發請求定製器。或者,Spring 4.3+使用者可以利用轉發頭過濾器。