-
Notifications
You must be signed in to change notification settings - Fork 0
MS_SAMLMetadata
- 戻る(SAMLの仕様を読む。)
- SAML Metadata
- Authentication Context
- SAML Core
SAML パーティ(IdP / SP)間で設定情報を表現・共有する XML スキーマ。
これにより、IdP と SP の信頼関係(トラストサークル)を構築する。
補足(何のためにあるか): メタデータが無いと、
IdP と SP の接続には次を手作業で交換する必要がある。
- EntityID(相手の一意識別子)
- エンドポイント URL(SSO Service / ACS / SLO)
- 署名検証用の証明書
- サポートする
NameIDFormat/ Bindingメタデータ XML を 1 つ渡せばこれらが全部揃う、というのが要点。
OpenID Connect の
/.well-known/openid-configuration+jwks_uriに相当する。
| 要素 | 内容 |
|---|---|
<EntitiesDescriptor> |
複数の <EntityDescriptor> をまとめる(フェデレーション全体のメタデータ) |
<EntityDescriptor> |
1 エンティティの記述。entityID 属性が一意識別子 |
<IDPSSODescriptor> |
IdP としての役割の記述 |
<SPSSODescriptor> |
SP としての役割の記述 |
<KeyDescriptor> |
鍵(証明書)。use="signing" / use="encryption"
|
<SingleSignOnService> |
IdP の SSO 受付エンドポイント(Binding + Location) |
<AssertionConsumerService> |
SP のアサーション受付エンドポイント(index 付き) |
<SingleLogoutService> |
SLO エンドポイント |
<NameIDFormat> |
サポートする NameID の形式 |
<AttributeConsumingService> |
SP が要求する属性のセット |
<Organization> / <ContactPerson>
|
運用主体・連絡先 |
- ルート要素の主な属性
| 属性 | 内容 |
|---|---|
entityID |
エンティティの一意識別子(通常 URL 形式だが、URL として解決可能である必要はない) |
validUntil |
メタデータの有効期限 |
cacheDuration |
推奨キャッシュ期間 |
WantAuthnRequestsSigned(IdP 側) |
要求への署名を要求するか |
AuthnRequestsSigned / WantAssertionsSigned(SP 側) |
同上(SP 視点) |
補足(
validUntilを無視しない): メタデータには
**validUntil(有効期限)**があり、期限切れのメタデータは
拒否しなければならない([SAMLMeta] の規定)。実務ではここが運用事故の温床になる。
- フェデレーション(学認・eduGAIN など)は
メタデータを定期的に再取得する前提でvalidUntilを数日〜数週間に設定する。- 手動でファイルを配置した SP は更新を忘れ、ある日突然 SSO が止まる。
同じ理由で、署名証明書の有効期限切れも定番の障害である。
新旧 2 枚の<KeyDescriptor use="signing">を並べておけば、
切り替え期間中も検証が通る(JWK の鍵ロールオーバーと同じ考え方)。
- メタデータ文書は
<ds:Signature>で署名できる
(XML署名・暗号)。 - 署名プロファイル
- Enveloped 署名
-
<ds:Reference>はルート要素のIDを参照 - Canonicalization は Exclusive C14N
補足(メタデータの入手経路が信頼の起点): メタデータには
相手を検証するための証明書が入っている。
したがって「メタデータをどう安全に受け取るか」が
信頼チェーンの出発点になる。
方法 安全性 HTTPS の Well-Known URL から取得 TLS のサーバ認証に依存(最低限) メタデータ自体に署名し、署名検証鍵を別経路で配布 フェデレーション運用で標準 メールで XML を送る / 手入力 経路の保証がない(要指紋確認) メタデータを HTTP(平文)で取りに行く実装は論外である。
中間者が証明書を差し替えれば、任意のアサーションを通せる。
-
Well-Known Location —
entityIDが URL の場合、その URL から取得する - DNS(NAPTR レコード) — 仕様には定義があるが、実装はほぼ無い
IDPSSODescriptor
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
entityID="https://accounts.google.com/o/saml2" validUntil="2022-02-28T14:34:20.000Z">
<md:IDPSSODescriptor WantAuthnRequestsSigned="false"
protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>CERTIFICATE</ds:X509Certificate>
</ds:X509Data>
</ds:KeyInfo>
</md:KeyDescriptor>
<md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat>
<md:SingleSignOnService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://accounts.google.com/o/saml2/idp"/>
<md:SingleSignOnService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://accounts.google.com/o/saml2/idp"/>
</md:IDPSSODescriptor>
</md:EntityDescriptor>- G suiteのSAML認証の設定方法 – サポート
SSO/IDaaSならトラスト・ログイン by GMO【旧SKUID(スクイド)】
https://support.trustlogin.com/hc/ja/articles/115003760514
IDPSSODescriptor
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
ID="_ceca4e9c-2656-40c1-8e83-cce46b99284a"
entityID="https://sts.windows.net/6babcaad-604b-40ac-a9d7-9fd97c0b779f/">
<IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<KeyDescriptor use="signing">
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data>
<X509Certificate>...</X509Certificate>
</X509Data>
</KeyInfo>
</KeyDescriptor>
<KeyDescriptor use="signing">
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data>
<X509Certificate>...</X509Certificate>
</X509Data>
</KeyInfo>
</KeyDescriptor>
<SingleLogoutService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://login.microsoftonline.com/6babcaad-.../saml2"/>
<SingleSignOnService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://login.microsoftonline.com/6babcaad-.../saml2"/>
<SingleSignOnService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://login.microsoftonline.com/6babcaad-.../saml2"/>
</IDPSSODescriptor>
</EntityDescriptor>補足: この例で
<KeyDescriptor use="signing">が
2 つ並んでいるのは、まさに前述の鍵ロールオーバーである。
SP はどちらの証明書でも検証できるようにしておく必要がある
(=「1 枚だけ読み込む」実装は、鍵更新時に必ず壊れる)。
- SAML プロトコル リファレンス
https://learn.microsoft.com/entra/identity-platform/single-sign-on-saml-protocol - フェデレーション メタデータ
https://learn.microsoft.com/entra/identity-platform/federation-metadata https://login.microsoftonline.com/<ドメイン>/FederationMetadata/2007-06/FederationMetadata.xml
<EntityDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata"
ID="_5197a745-3513-4b82-a809-92269b4dbb18"
entityID="http://fs.customer.com/adfs/services/trust">
<IDPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<KeyDescriptor use="encryption">
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data>
<X509Certificate>...</X509Certificate>
</X509Data>
</KeyInfo>
</KeyDescriptor>
<KeyDescriptor use="signing">
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<X509Data>
<X509Certificate>...</X509Certificate>
</X509Data>
</KeyInfo>
</KeyDescriptor>
<SingleLogoutService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://fs.customer.com/adfs/ls/"/>
<SingleLogoutService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://fs.customer.com/adfs/ls/"/>
<NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</NameIDFormat>
<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
<SingleSignOnService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"
Location="https://fs.customer.com/adfs/ls/"/>
<SingleSignOnService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://fs.customer.com/adfs/ls/"/>
</IDPSSODescriptor>
</EntityDescriptor>移行メモ: 元ページの見出しは「ADFD」だったので、
AD FS に改めた。補足:
entityIDがhttp://で始まっているが、これは正しい。
entityIDは識別子であって URL ではないため、
スキームがhttpでも「平文通信する」という意味にはならない。
AD FS の既定値がこの形である。
- Starmind Docs - Single-Sign-On Metadata
https://docs.starmind.com/authentication/sso/metadata/
SPSSODescriptor
<md:EntityDescriptor entityID="https://(sub_domain).cybozu.com">
<md:SPSSODescriptor protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:NameIDFormat>
urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
</md:NameIDFormat>
<md:AssertionConsumerService
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
Location="https://(sub_domain).cybozu.com/saml/acs" index="0"/>
</md:SPSSODescriptor>
</md:EntityDescriptor>- SAML認証ができるまで - Cybozu Inside Out | サイボウズエンジニアのブログ
https://blog.cybozu.io/entry/4224
- SAML2.0サービスプロバイダーのメタデータ - Qiita
https://qiita.com/oTsogbadrakhChinzorig/items/c5210e548b6ff02281d2
- SAML 2.0 saml-schema-metadata-2.0.xsd
http://www.datypic.com/sc/saml2/s-saml-schema-metadata-2.0.xsd.html- SAML 2.0 md:IDPSSODescriptor
http://www.datypic.com/sc/saml2/e-md_IDPSSODescriptor.html - SAML 2.0 md:SPSSODescriptor
http://www.datypic.com/sc/saml2/e-md_SPSSODescriptor.html
- SAML 2.0 md:IDPSSODescriptor
https://docs.oasis-open.org/security/saml/v2.0/saml-metadata-2.0-os.pdf
1 Introduction
1.1 Notation
2 Metadata for SAML V2.0
2.1 Namespaces
2.2 Common Types
2.2.1 Simple Type entityIDType
2.2.2 Complex Type EndpointType
2.2.3 Complex Type IndexedEndpointType
2.2.4 Complex Type localizedNameType
2.2.5 Complex Type localizedURIType
2.3 Root Elements
2.3.1 Element <EntitiesDescriptor>
2.3.2 Element <EntityDescriptor>
2.3.2.1 Element <Organization>
2.3.2.2 Element <ContactPerson>
2.3.2.3 Element <AdditionalMetadataLocation>
2.4 Role Descriptor Elements
2.4.1 Element <RoleDescriptor>
2.4.1.1 Element <KeyDescriptor>
2.4.2 Complex Type SSODescriptorType
2.4.3 Element <IDPSSODescriptor>
2.4.4 Element <SPSSODescriptor>
2.4.4.1 Element <AttributeConsumingService>
2.4.4.2 Element <RequestedAttribute>
2.4.5 Element <AuthnAuthorityDescriptor>
2.4.6 Element <PDPDescriptor>
2.4.7 Element <AttributeAuthorityDescriptor>
2.5 Element <AffiliationDescriptor>
2.6 Examples
3 Signature Processing
3.1 XML Signature Profile
3.1.1 Signing Formats and Algorithms
3.1.2 References
3.1.3 Canonicalization Method
3.1.4 Transforms
3.1.5 KeyInfo
4 Metadata Publication and Resolution
4.1 Publication and Resolution via Well-Known Location
4.2 Publishing and Resolution via DNS
4.3 Post-Processing of Metadata
4.3.1 Metadata Instance Caching
4.3.2 Handling of HTTPS Redirects
4.3.3 Processing of XML Signatures and General Trust Processing
5 References
Appendix A. Registration of MIME media type application/samlmetadata+xml
Appendix B. Acknowledgments
Appendix C. Notices
Tags: 移行, IT国際標準, 認証基盤, クレームベース認証, SAML
このWikiは「Open棟梁Project」,「OSSコンソーシアム 開発基盤部会」によって運営されています。