Liberty Repository[8.5.5.4 或更高版本]

在 Liberty 概要文件中配置 OpenID Connect 客户机

可配置 Liberty 概要文件服务器以充当 OpenID Connect 客户机或依赖方,以使用 Web 单点登录并将 OpenID Connect 提供者用作身份提供者。

关于此任务

通过启用 Liberty 概要文件的 openidConnectClient-1.0 功能部件并配置其他配置信息,可配置 Liberty 概要文件服务器以充当 OpenID Connect 客户机。

过程

  1. openidConnectClient-1.0 Liberty 功能部件及任何其他所需功能部件添加至 server.xml 文件。对于 openidConnectClient-1.0 功能部件,还需要 ssl-1.0 功能部件。在 server.xml 文件的 featureManager 元素内添加以下元素声明:
    <feature>openidConnectClient-1.0</feature> 	
    <feature>ssl-1.0</feature>
  2. 配置 openidConnectClient 元素。以下是使用缺省 Liberty 概要文件服务器 OpenID Connect 提供者的基本配置的示例。

    对于该客户机,在给定 URL 模式中必须有相应的已配置应用程序,以便能够处理来自 OpenID Connect 提供者的重定向请求。此 URL 还必须与客户机向 OP 注册的重定向 URL 精确匹配。

    注: 在此示例中,客户机期望 OP 的 SSL 端口设置为 443。
    <openidConnectClient id="client01" 		
        clientId="client01" 		
        clientSecret="{xor}LDo8LTor" 		
        authorizationEndpointUrl="https://server.example.com:443/oidc/endpoint/OidcConfigSample/authorize" 		
        tokenEndpointUrl="https://server.example.com:443/oidc/endpoint/OidcConfigSample/token"> 	
    </openidConnectClient>
    在此基本配置样本中,采用以下缺省值:
    • scope=openid profile:范围 openid 是必需的,您可使用 scope 属性以编辑必需范围。例如,可将必需 scope 更改为 openid profile email
    • 此 RP 向 OP 将其重定向 URL 注册为 https://<host name>:<ssl port>/oidcclient/redirect/client01,其中主机名和 ssl 端口是自动解析的,client01openidConnectClient 配置元素的标识。如果 RP 前端有代理,那么您可使用属性 redirectToRPHostAndPort 覆盖主机名和端口,并将 redirectToRPHostAndPort 设置为 https://<host name>:<ssl port>
  3. 配置用户注册表。缺省情况下,OP 返回的用户身份不会映射至注册表用户,所以不需要在注册表中配置用户。但是,如果 openidConnectClient 元素的 mapIdentityToRegistryUser 属性设置为 true,那么从 OP 返回的相应身份必须有对应的用户条目,认证和授权才能成功。有关配置用户注册表的更多信息,请参阅为 Liberty 概要文件配置用户注册表
  4. 配置服务器的信任库以包含受支持的 OpenID Connect 提供者的签署者证书。有关密钥库的信息,请参阅对 Liberty 概要文件启用 SSL 通信
  5. 修改服务器的 SSL 配置以使用所配置信任库。
    <sslDefault sslRef="DefaultSSLSettings" /> 
    <ssl id="DefaultSSLSettings" keyStoreRef="myKeyStore" trustStoreRef="myTrustStore" /> 	
    <keyStore id="myKeyStore" password="{xor}EzY9Oi0rJg==" type="jks" location="${server.config.dir}/resources/security/BasicKeyStore.jks" /> 	
    <keyStore id="myTrustStore" password="{xor}EzY9Oi0rJg==" type="jks" location="${server.config.dir}/resources/security/BasicTrustStore.jks" />

    OpenID Connect 配置为使用服务器指定的缺省 SSL 配置。因此,服务器的缺省 SSL 配置必须使用为 OpenID Connect 配置的信任库。

  6. [8.5.5.5 或更高版本]可选:配置第三方 OpenID Connect 提供者。

    要配置 Liberty OpenID Connect 客户机以使用第三方 OpenID Connect 提供者(例如,Microsoft Azure 或 Google),必须配置以下属性。可通过调用 OP 的发现端点获取属性值,此端点在通过将字符串 /.well-known/openid-configuration 连接至发出者形成的路径上提供 JSON 文档。

    1. jwkEndpointUrl 属性设置为 OP 的 JSON Web 密钥集 JWK 文档的 URL,此 URL 在发现文件中定义为 jwks_uri。例如,要使用 Google 的 OP,您可设置 jwkEndpointUrl = "https://www.googleapis.com/oauth2/v2/certs"
    2. issuerIdentifier 属性设置为发现文件中定义的 issuer。未包含此值作为 iss 声明的标识令牌会被拒绝。例如,如果您将 Google 用作 OP,那么可设置 issuerIdentifier="accounts.google.com"
    3. 设置 signatureAlgorithm="RS256"。Liberty OpenID Connect 客户机的缺省签名算法为 HS256。
    4. userIdentityToCreateSubject 属性设置为表示用户唯一标识的供应商标识令牌使用的声明名称。例如,如果您使用 Google 的 OP,那么您可设置 userIdentityToCreateSubject ="email",如果您使用 Microsoft Azure,那么您可设置 userIdentityToCreateSubject ="upn"userIdentityToCreateSubject ="unique_name"
    5. groupIdentifier 属性设置为表示用户组成员资格或角色的声明名称。例如,如果您使用 Microsoft Azure,那么可设置 groupIdentifier="groups"

    有关更多 OpenID Connect 客户机配置选项,请参阅在 server.xml 文件中配置元素

  7. [8.5.5.5 或更高版本]可选:认证过滤器。

    如果已启用 openidConnectClient-1.0 功能部件并且未对 openidConnectClient 元素配置 authFilterRef 属性,那么系统通过 OpenID Connect 提供者认证任何未认证的请求。

    有关配置认证过滤器的更多信息,请参阅Liberty Repository[8.5.5.5 或更高版本]认证过滤器

  8. 支持多个 OpenID Connect 提供者。

    通过创建多个 openidConnectClient 元素和多个认证过滤器,可将 Liberty 概要文件配置为多个 OpenID Connect 提供者的 OpenID Connect 依赖方。每个 openidConnectClient 元素定义与一个 OpenID Connect 提供者的单点登录关系,并使用 authFilterRef 属性引用一个认证过滤器。

结果

您现在已建立将 Liberty 概要文件服务器配置为 OpenID Connect 客户机(它能够与配置为 OpenID Connect 提供者的其他 Liberty 概要文件服务器通信)时所需的基本配置。

用于指示主题类型的图标 任务主题

信息中心的条款和条件 | 反馈


时间戳记图标 最近一次更新时间: Wednesday, 2 September 2015
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-libcore-mp&topic=twlp_config_oidc_rp
文件名:twlp_config_oidc_rp.html