用于 SAML 的应用程序编程接口 (API) 的概述

适用于 SAML 的 WebSphere® Application Server 支持提供了公共应用程序编程接口 (API),您可以使用这些 API 来构建 SAML 令牌感知应用程序。

使用 SAMLTokenFactory API 来创建、验证和认证 SAML 令牌,以及创建用于表示 SAML 令牌的 JAAS 主体集。 SAMLTokenFactory 实现同时支持 OASIS SAML V1.1 令牌规范和 OASIS SAML V2.0 令牌规范。使用 WSSTrustClient API 来发送、发放和验证 WS-Trust 请求消息至指定的 STS。WSSTrustClient 实现同时支持 WS-Trust V1.3 规范和 WS-Trust V1.2 规范,也同时支持 SOAP V1.1 名称空间和 SOAP V1.2 名称空间。

注: 从 WebSphere Application Server R8 开始,可以在 Web service 安全性 (WSS) 应用程序编程接口 (API) 中使用 com.ibm.websphere.wssecurity.wssapi.token.SAMLToken 类。不存在混淆问题时,我们使用术语 SAMLToken 来代替使用其完整的软件包名称。您可以使用 WSS API 从外部安全性令牌服务 (STS) 请求 SAMLToken 处理、在 SOAP 请求消息中传播 SAMLToken,以及使用 SAMLToken 确定的对称或非对称密钥来保护 SOAP 消息。

WSS API SAML 支持对 com.ibm.websphere.wssecurity.wssapi.token.SAMLTokenFactorycom.ibm.websphere.wssecurity.wssapi.trust.WSSTrustClient 接口进行了补充。使用 com.ibm.websphere.wssecurity.wssapi.WSSFactory newSecurityToken() 方法生成的 SAMLToken 可以由 SAMLTokenFactoryWSSTrustClient 编程接口处理。相反,由 SAMLTokenFactory 生成或由 WSSTrustClient 返回的 SAMLToken 可以用在 WSS API 中。确定要在应用程序中使用哪个 API 取决于您的具体需求。就 Web service 客户机应用程序而言,WSS API SAML 支持可提供与 SAMLTokenFactoryWSSTrustClient 接口同等的功能,在这种意义上,该支持是完备的。SAMLTokenFactory 接口具有更多功能,可验证 SAMLToken 以及创建表示已认证 SAMLToken 的 JAAS 主体。此验证对于 Web service 提供者端十分有用。当您开发应用程序以处理 SAMLToken 时,SAMLTokenFactory 编程接口更适合您。

带有 SAML 的 WebSphere Application Server 提供了以下 API,这些 API 可将 SAML 实现为安全性令牌。 有关这些 API 中的方法的信息,请参阅 SAML 令牌库 API 文档,该文档描述了每一个 API 并提供了样本代码。

SAMLTokenFactory API 是主要的 SAML 令牌编程接口。使用此 API,您可以创建 SAML 令牌,插入 SAML 属性,将 SAML 声明解析并验证为 SAML 令牌的 XML 表示以及创建用于表示用户标识和属性的 JAAS 主体集(如 SAML 令牌中定义)。
  • com.ibm.websphere.wssecurity.wssapi.token.SAMLTokenFactory
  • com.ibm.websphere.wssecurity.wssapi.token.SAMLToken
SAMLAttribute 和 SAMLNameID 系统编程接口 (SPI) 分别表示 SAML 属性和 SAML 用户名标识。
  • com.ibm.wsspi.wssecurity.saml.data.SAMLAttribute
  • com.ibm.wsspi.wssecurity.saml.data.SAMLNameID
使用以下 SAML SPI,您可以指定 SAML 令牌的创建方式和 SAML 声明 XML 文档的验证方式。ProviderConfig 对象指定 SAML 声明签发者的配置信息,这些信息包括签发者名称、签发者签名密钥和签名证书。 RequesterConfig 对象包含配置参数,这些配置参数用于在创建 SAML 声明 和 SAML 令牌时定义它们的特征。这些配置参数包括确认方法、SAML 声明的签名、嵌入式加密密钥类型和认证方法。ConsumerConfig 对象包含用于定义如何验证 SAML 声明 XML 文档的配置参数,包括解密密钥信息、加密算法、时钟偏差的计时器值以及是否需要签发者的数字签名。
  • com.ibm.wsspi.wssecurity.saml.config.ConsumerConfig
  • com.ibm.wsspi.wssecurity.saml.config.CredentialConfig
  • com.ibm.wsspi.wssecurity.saml.config.ProviderConfig
  • com.ibm.wsspi.wssecurity.saml.config.RequesterConfig
  • com.ibm.wsspi.wssecurity.saml.config.SamlConstants
  • com.ibm.wsspi.wssecurity.core.token.config.ConsumerConfiguration
  • com.ibm.wsspi.wssecurity.core.token.config.CredentialConfiguration
  • com.ibm.wsspi.wssecurity.core.token.config.ProviderConfiguration
  • com.ibm.wsspi.wssecurity.core.token.config.RequesterConfiguration
以下 SAML Callback 和 CallbackHandler 类指定您可以用来定义 SAML 声明的特征和控制 SAML LoginModule 在运行时环境中的行为的配置参数。这些参数存储在 Web Service 安全性绑定文档中。SAML 令牌配置由 Web Service 安全性策略配置中的 CustomToken 扩展进行建模。
  • com.ibm.websphere.wssecurity.callbackhandler.SAMLConsumeCallback
  • com.ibm.websphere.wssecurity.callbackhandler.SAMLConsumerCallbackHandler
  • com.ibm.websphere.wssecurity.callbackhandler.SAMLGenerateCallback
  • com.ibm.websphere.wssecurity.callbackhandler.SAMLGenerateCallbackHandler
com.ibm.websphere.wssecurity.wssapi.token.SecurityToken 编程接口中的 getXML() 方法返回用于实现 XMLStructure 接口的对象。由 WebSphere Application Server 添加的增强功能支持定制 SecurityToken 实现。使用以下两个 SPI,您可以部署 Axis2 Axiom OM 实现或 DOM 实现。SAML 令牌会扩展 GenericSecurityToken 接口,该接口接下来会扩展 SecurityToken 接口。GenericSecurityToken 是由带有 SAML 的 WebSphere Application Server 添加的一个新接口。SAML 令牌还实现 OMStructure 接口。
  • com.ibm.wsspi.wssecurity.wssapi.DOMStructure
  • com.ibm.wsspi.wssecurity.wssapi.OMStructure
WS-Trust 客户机 API 包括 WSSTrustClient 类和其他辅助 API 及 SPI。WSSTrustClient API 将 WS-Trust SOAP 请求发送给指定的外部安全性令牌服务 (STS)(以便 STS 可以发出或验证一个或多个 SAML 声明)或其他类型的安全性令牌。WSSTrustClient 同时支持 WS-Trust V1.3 规范和 WS-Trusts V1.2 规范。当 API 调用者请求 SAML 令牌类型时,WSSTrustClient API 会返回 SAML 令牌。 当 API 调用者请求非 SAML 令牌类型时,该 API 还使用 GenericSecurityToken 接口。有关更多信息和样本代码,请参阅 WS-Trust 客户机 API 的相关内容。有关 API 和 SPI 的详细讨论,请参阅 API 文档。
  • com.ibm.websphere.wssecurity.wssapi.trust.WSSTrustClient
  • com.ibm.websphere.wssecurity.wssapi.token.GenericSecurityToken
请使用以下 SPI 来指定令牌的特征及其在运行时环境中的行为。ProviderConfig 对象包含配置参数,这些配置参数用于指定 STS 端点、Web Service 安全性策略集、用于访问 STS 的绑定文档以及是使用常规绑定还是使用特定于应用程序的绑定。ProviderConfig 对象还指定将 RequestSecurityTokenResponse (RSTR) XML 文档存储在 GenericSecurityToken 对象中还是存储在 SAMLToken 对象中。RequesterConfig 对象包含在 WS-Trust 请求中发送给指定 STS 的配置参数。ConsumerConfig 接口定义 WS-Trust 响应消息的属性和数据以及 RequestSecurityTokenResponse 元素的属性和数据。此数据通过使用 GenericSecurityToken getProperties() 方法进行检索。调用 ProviderConfig setIncludeRSTRProperties() 时,会将 RequestSecurityTokenResponse XML 元素作为属性进行存储。如果 ConsumerConfig 接口未定义应用程序所需的某个特定属性,那么您可以改为检索和解析 RSTR 元素。
  • com.ibm.wsspi.wssecurity.trust.config.ConsumerConfig
    • com.ibm.wsspi.wssecurity.trust.config.ConsumerConfig.RSTR
  • com.ibm.wsspi.wssecurity.trust.config.ProviderConfig
  • com.ibm.wsspi.wssecurity.trust.config.RequesterConfig
  • com.ibm.wsspi.wssecurity.core.token.config.WSSConstants
    • com.ibm.wsspi.wssecurity.core.token.config.WSSConstants.Namespace
    • com.ibm.wsspi.wssecurity.core.token.config.WSSConstants.TokenType
    • com.ibm.wsspi.wssecurity.core.token.config.WSSConstants.WST12
    • com.ibm.wsspi.wssecurity.core.token.config.WSSConstants.WST13
    • com.ibm.wsspi.wssecurity.core.token.config.WSSConstants.Algorithm
    • com.ibm.wsspi.wssecurity.core.token.config.WSSConstants.SAML

有关使用 API 的更多信息(包括用于说明 API 的应用方式及应用时间的实际场景),请参阅 SAML 使用方案的相关内容。


指示主题类型的图标 概念主题



时间戳记图标 最近一次更新时间: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=cwbs_overviewsamlapis
文件名:cwbs_overviewsamlapis.html