Skip to main content

2026 年 7 月 1 日

使用 SAML 的標頭式驗證

從 IDP 到 SP (在身分識別橋接的情況下為 Unified Access Gateway) 的 SAML 回應包含 SAML 判斷提示,這些判斷提示具有 SAML 屬性。SAML 屬性可在 IDP 中設定為指向不同的參數,例如使用者名稱和電子郵件等。

在使用 SAML 的標頭式驗證中,SAML 屬性的值可作為 HTTP 標頭傳送至後端代理目的地。在 Unified Access Gateway 中定義的 SAML 屬性名稱與 IDP 中的名稱相同。例如,如果身分識別提供者將屬性定義為 Name: userName Value: idmadmin,則 Unified Access Gateway 中的 SAML 屬性名稱必須定義為 "userName"

系統會忽略與 IDP 中所定義屬性不相符的 SAML 屬性。Unified Access Gateway 支援多個 SAML 屬性以及多重值的 SAML 屬性。以下將針對各個案例,提供身分識別提供者預期會傳回的 SAML 判斷提示範例節錄。例如,

  1. 預期來自 IDP 的 SAML 回應,包含多個 SAML 屬性。

<saml:AttributeStatement> <saml:Attribute Name="userName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"> <saml:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">idmadmin</saml:AttributeValue> </saml:Attribute> <saml:Attribute Name="userEmail" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"> <saml:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">63ecfabf-a577-46c3-b4fa-caf7ae49a6a3</saml:AttributeValue> </saml:Attribute> </saml:AttributeStatement>

在上述範例中,判斷提示包含兩個屬性,即 "userName""userEmail"。如果僅為 "userName"設定了標頭式驗證,並且標頭名稱為 "HTTP_USER_NAME",則該標頭將以 "HTTP_USER_NAME: idmadmin" 的格式傳送。由於未在 Unified Access Gateway**** 上設定用於標頭式驗證的 "userEmail",因此不會將其作為標頭傳送。

  1. 預期來自 IDP 的 SAML 回應,包含多重值的 SAML 屬性。

<saml:AttributeStatement> <saml:Attribute Name="group" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic"> <saml:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">All Employees</saml:AttributeValue> <saml:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">All Contractors</saml:AttributeValue> <saml:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">All Executives</saml:AttributeValue> <saml:AttributeValue xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xsd:string">All</saml:AttributeValue> </saml:Attribute> </saml:AttributeStatement>

在上述範例中,屬性 "group" 包含四個值,即 "All Employees""All Contractors""All Executives""All"。如果僅為 "group" 設定了標頭式驗證,且標頭名稱為 "HTTP_GROUP",則傳送的標頭為 "HTTP_GROUP: All Employees, All Contractors, All Executives, All",並以所有屬性值的逗號分隔清單作為標頭值。

此頁面對您有幫助嗎?

針對本主題提供意見回饋

本主題對您有幫助嗎?

請勿填寫任何個人或機密資訊。

正在產生連結…