SAML 2.0

維基百科,自由的百科全書

安全斷言標記語言 2.0 (SAML 2.0) 作為 SAML 的最新標準, 用來在安全域中交換身份驗證Authentication)數據和 授權Authorization)數據。SAML 2.0基於XML協議,使用包含斷言(Assertions)的安全令牌在SAML授權方(即身份提供者英語Identity_provider,Identity_provider,縮寫為IdP)和SAML消費方(即服務提供者,Service Provider,縮寫為SP)之間傳遞委託人(通常是一個終端用戶)的信息。SAML 2.0 可以實現基於網絡跨域的單點登錄(SSO), 以便於減少向一個用戶分發多個身份驗證令牌的管理開銷。

SAML 2.0在2005年三月正式代替SAML 1.1英語SAML 1.1成為OASIS標準。SAML 2.0的關鍵特徵在官方文檔SAMLCore[1], SAMLBind[2],SAMLProf[3]和SAMLMeta[4]中有詳細地記載。

來自超過24個公司及團體的大約30人參與了SAML 2.0的創建。尤其是,自由聯盟英語Liberty Alliance將身份聯合框架規範(ID-FF)貢獻給OASIS,後者成為了SAML 2.0規範的基礎。 因此,SAML 2.0實際上是SAML 1.1英語SAML 1.1, Liberty ID-FF 1.2頁面存檔備份,存於互聯網檔案館)和Shibboleth 1.3英語Shibboleth (Shibboleth Consortium)三種協議的融合。

SAML 2.0斷言[編輯]

斷言是一個包含了由SAML授權方提供的0到多個聲明(statement)的信息包。SAML斷言通常圍繞一個主題生成。該主題使用<Subject>聲明。SAML 2.0規範定義了三種斷言聲明並且每一種都和一個主題相關。詳細信息如下:

  • 身份驗證(Authentication)斷言:該斷言的主題是在某個時間通過某種方式被認證。
  • 屬性(Attribute)斷言:該斷言的主題和某種屬性相關聯。
  • 授權決策(Authorization Decision)斷言:該斷言的主題被允許或者被禁止訪問某個資源。

一種非常重要的SAML斷言類型叫做「Bearer Assertion」。它主要是用來實現Web瀏覽器的單點登錄。下面是一個短期Bearer斷言的例子。一個IdP(https://idp.example.org/SAML2)發佈了一個短期Bearer斷言到一個SP(https://sp.example.com/SAML2)。該斷言包括一個身份驗證斷言<saml:AuthnStatement>和一個屬性斷言<saml:AttributeStatement>。SP將使用該屬性斷言實現訪問控制。前綴saml:代表SAML 2.0斷言的命名空間。

SAML斷言舉例[編輯]

<saml:Assertion
   xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
   xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   ID="b07b804c-7c29-ea16-7300-4f3d6f7928ac"
   Version="2.0"
   IssueInstant="2004-12-05T09:22:05Z">
   <saml:Issuer>https://idp.example.org/SAML2</saml:Issuer>
   <ds:Signature
     xmlns:ds="http://www.w3.org/2000/09/xmldsig#">...</ds:Signature>
   <saml:Subject>
     <saml:NameID
       Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient">
       3f7b3dcf-1674-4ecd-92c8-1544f346baf8
     </saml:NameID>
     <saml:SubjectConfirmation
       Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
       <saml:SubjectConfirmationData
         InResponseTo="aaf23196-1773-2113-474a-fe114412ab72"
         Recipient="https://sp.example.com/SAML2/SSO/POST"
         NotOnOrAfter="2004-12-05T09:27:05Z"/>
     </saml:SubjectConfirmation>
   </saml:Subject>
   <saml:Conditions
     NotBefore="2004-12-05T09:17:05Z"
     NotOnOrAfter="2004-12-05T09:27:05Z">
     <saml:AudienceRestriction>
       <saml:Audience>https://sp.example.com/SAML2</saml:Audience>
     </saml:AudienceRestriction>
   </saml:Conditions>
   <saml:AuthnStatement
     AuthnInstant="2004-12-05T09:22:00Z"
     SessionIndex="b07b804c-7c29-ea16-7300-4f3d6f7928ac">
     <saml:AuthnContext>
       <saml:AuthnContextClassRef>
         urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
       </saml:AuthnContextClassRef>
     </saml:AuthnContext>
   </saml:AuthnStatement>
   <saml:AttributeStatement>
     <saml:Attribute
       xmlns:x500="urn:oasis:names:tc:SAML:2.0:profiles:attribute:X500"
       x500:Encoding="LDAP"
       NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
       Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.1"
       FriendlyName="eduPersonAffiliation">
       <saml:AttributeValue
         xsi:type="xs:string">member</saml:AttributeValue>
       <saml:AttributeValue
         xsi:type="xs:string">staff</saml:AttributeValue>
     </saml:Attribute>
   </saml:AttributeStatement>
 </saml:Assertion>

參考文獻[編輯]

一手來源:

  1. ^ S. Cantor et al. Assertions and Protocols for the OASIS Security Assertion Markup Language (SAML) V2.0 – Errata Composite. Working Draft 07, 8 September 2015. Document ID sstc-saml-core-errata-2.0-wd-07 http://www.oasis-open.org/committees/download.php/56776/sstc-saml-core-errata-2.0-wd-07.pdf
  2. ^ S. Cantor et al. Bindings for the OASIS Security Assertion Markup Language (SAML) V2.0 – Errata Composite. Working Draft 06, 8 September 2015. Document ID sstc-saml-bindings-errata-2.0-wd-06 https://www.oasis-open.org/committees/download.php/56779/sstc-saml-bindings-errata-2.0-wd-06.pdf
  3. ^ J. Hughes et al. Profiles for the OASIS Security Assertion Markup Language (SAML) V2.0 – Errata Composite. Working Draft 07, 8 September 2015. Document ID sstc-saml-profiles-errata-2.0-wd-07 https://www.oasis-open.org/committees/download.php/56782/sstc-saml-profiles-errata-2.0-wd-07.pdf
  4. ^ S. Cantor et al. Metadata for the OASIS Security Assertion Markup Language (SAML) V2.0 – Errata Composite. Working Draft 05, 8 September 2015. Document ID sstc-saml-metadata-errata-2.0-wd-05 https://www.oasis-open.org/committees/download.php/56785/sstc-saml-metadata-errata-2.0-wd-05.pdf