跳到主要内容

5. Metadata for Mutual-TLS Endpoint Aliases (Mutual-TLS 端点别名的元数据)

5. Metadata for Mutual-TLS Endpoint Aliases (Mutual-TLS 端点别名的元数据)

协商基于客户端证书的 mutual TLS 时, TLS 服务器会向 TLS 客户端请求证书 (客户端不会主动提供). 尽管可将服务器配置为客户端证书可选, 即客户端未提供证书时仍允许连接继续, 但服务器请求证书的行为可能导致某些客户端出现不良行为. 对作为 TLS 客户端的 Web 浏览器尤其如此: 当服务器请求证书时, 浏览器通常向最终用户呈现侵入式的证书选择界面.

同时支持使用 mutual TLS 的客户端与常规客户端的授权服务器可以选择将服务器端 mutual-TLS 行为仅隔离给打算进行 mutual TLS 的客户端, 从而避免对常规客户端可能产生的不良影响. 引入以下授权服务器元数据参数以促进此类分离:

mtls_endpoint_aliases

可选. JSON 对象, 包含替代的授权服务器端点; 当存在时, 打算进行 mutual TLS 的 OAuth 客户端优先使用这些端点而非常规端点. 参数值本身由一个或多个端点参数组成, 例如 token_endpoint, revocation_endpoint, introspection_endpoint 等, 按授权服务器元数据顶层常规方式定义. 当打算进行 mutual TLS 的 OAuth 客户端 (为 OAuth 客户端认证和/或获取或使用证书绑定令牌) 直接向授权服务器发出请求时, 若存在 mtls_endpoint_aliases, 必须优先使用该对象内同名端点的别名 URL, 而非元数据顶层的同名端点 URL. 当某端点未出现在 mtls_endpoint_aliases 中时, 客户端使用授权服务器元数据顶层定义的常规端点 URL. mtls_endpoint_aliases 内不定义 OAuth 客户端直接请求所至端点的元数据参数无意义, 应该被忽略.

以下是带 mtls_endpoint_aliases 参数的授权服务器元数据文档示例, 指明打算进行 mutual TLS 的 OAuth 客户端将优先使用的 token, revocation 与 introspection 端点别名, 以替代常规 token, revocation 与 introspection 端点. 注意 mtls_endpoint_aliases 中的端点使用与常规对应项不同的主机, 使授权服务器能够通过 TLS server_name 扩展 [RFC6066] 或实际不同主机来适当区分其 TLS 行为.

{
"issuer": "https://server.example.com",
"authorization_endpoint": "https://server.example.com/authz",
"token_endpoint": "https://server.example.com/token",
"introspection_endpoint": "https://server.example.com/introspect",
"revocation_endpoint": "https://server.example.com/revo",
"jwks_uri": "https://server.example.com/jwks",
"response_types_supported": ["code"],
"response_modes_supported": ["fragment","query","form_post"],
"grant_types_supported": ["authorization_code", "refresh_token"],
"token_endpoint_auth_methods_supported":
["tls_client_auth","client_secret_basic","none"],
"tls_client_certificate_bound_access_tokens": true,
"mtls_endpoint_aliases": {
"token_endpoint": "https://mtls.example.com/token",
"revocation_endpoint": "https://mtls.example.com/revo",
"introspection_endpoint": "https://mtls.example.com/introspect"
}
}

图 4: 含 Mutual-TLS 端点别名的授权服务器元数据示例