「マイクロソフト系技術情報 Wiki」は、「Open棟梁Project」,「OSSコンソーシアム .NET開発基盤部会」によって運営されています。
目次 †
概要 †
汎用認証サイトにSAML2.0を実装するため仕様を読む。
- ターゲットはSP Initiated な Web Browser SSO Profileに絞る。
- ココに書いた情報は、SAML Core の Protocolsの範囲。
以下、詳細 †
以下について説明する。
- トランスポートプロトコルを使用して
- プロトコルメッセージをトランスポートする特定の手段
※ saml-core-2.0-os.pdfの内容が微妙なので、
SAML 要求・応答メッセージ †
要求メッセージ(AuthnRequest?) †
SPはIdP に認証を要求する<AuthnRequest?>メッセージを発行
Attribute †
# | パラメタ | 要否 | 値 | 既定値 | 内容 | 汎用認証サイト |
1 | ID | Required | xs:ID | - | 400ビット以内のID。 応答の InResponseTo? 属性の値は一致させる。 | ○ |
2 | Version | Required | "2.0" | バージョンを指定 | ○ |
3 | IssueInstant? | Required | UTC time | - | 発行時刻を指定 | ○ |
4 | ProtocolBinding? | Optional | URI | - | 応答のProtocol Bindingを識別する参照 URI(AssertionConsumerServiceURLと併用) | ○(Redirect or Post) |
5 | AssertionConsumerServiceURL | Optional | URI | - | 応答のURLを識別する参照 URI(Protocol Bindingと併用) | ○(完全一致) |
6 | AssertionConsumerServiceIndex? | Optional | unsigned Short | - | 応答のURLを識別するインデックス(ProtocolBinding?とAssertionConsumerServiceURLと排他的でメタデータと併用) | - |
7 | AttributeConsumingServiceIndex? | Optional | unsigned Short | - | IdPに要求するユーザ属性グループのインデックス(メタデータと併用) | - |
8 | Destination | Optional | URI | - | IdP のURI | - |
9 | ProviderName? | Optional | string | - | SPの可読名称 | - |
10 | Consent | Optional | URI | urn:oasis:names:tc:SAML:2.0:consent:unspecified | 利用者から得られている同意の有無や条件 | - |
11 | ForceAuthn? | Optional | boolean | false | true の場合、IdP は認証情報を再要求 | - |
12 | IsPassive? | Optional | boolean | false | true の場合、IdP はログインに介入してはならない。 | - |
Elements †
# | パラメタ | 要否 | 値 | 既定値 | 内容 | 汎用認証サイト |
1 | saml:Issuer | Optional | URI | - | SP の URI | -(署名があるので) |
2 | ds:Signature | Optional | - | XML署名 | ○ |
3 | saml:Subject | Optional | - | Subjectを入力する(login_hint的な。) | ○ |
4 | samlp:NameIDPolicy | Optional | - | Subjectの制約条件を指定(Format、 SPNameQualifier?、AllowCreate?) | ○(Format) |
5 | samlp:RequestedAuthnContext? | Optional | - | 認証コンテキストに関する要件を指定 | ○ |
6 | saml:Conditions | Optional | - | アサーション構築プロセスの入力 | - |
7 | samlp:Scoping | Optional | - | SPが信頼するIdPリスト | - |
8 | samlp:Extensions | Optional | - | 拡張ステートメント | - |
応答メッセージ(Response) †
IdP が認証アサーションを入れた<Response> メッセージを応答する。
Attribute †
# | パラメタ | 要否 | 値 | 既定値 | 内容 | 汎用認証サイト |
1 | ID | Required | xs:ID | - | 400ビット以内のID | ○ |
2 | Version | Required | "2.0" | バージョンを指定 | ○ |
3 | IssueInstant? | Required | UTC time | - | 発行時刻を指定 | ○ |
4 | InResponseTo? | Optional | xs:ID | - | 対応する要求メッセージのID。指定の場合、要検証。 | ○(state代替) |
5 | Destination | Optional | URI | - | SPのURI | - |
6 | Consent | Optional | URI | urn:oasis:names:tc: SAML:2.0:consent:unspecified | 利用者から得られている同意の有無や条件 | - |
Elements †
# | パラメタ | 要否 | 値 | 既定値 | 内容 | 汎用認証サイト |
1 | saml:Issuer | Optional | URI | - | IdPのURI | -(署名があるので) |
2 | ds:Signature | Optional | - | XML署名 | ○ |
3 | samlp:Status | Optional | URL | - | 処理ステータスコード | ○ |
4 | saml:Assertion | Optional | - | 認証アサーション | ○ |
共通的なメッセージ †
ResponseとAssertionに共通
Status †
- Elements
# | パラメタ | 要否 | 値 | 既定値 | 内容 | 汎用認証サイト |
1 | samlp:StatusCode? | Required | URI | - | ステータスを表すコードを指定(下記参照) | ○ |
2 | samlp:StatusMessage? | Optional | URI | - | オペレータに返すメッセージ | ○ |
3 | samlp:StatusDetail? | Optional | URI | - | URIで付加情報の名称空間を指定 | - |
Status †
- Attribute
# | パラメタ | 要否 | 値 | 既定値 | 内容 | 汎用認証サイト |
1 | Value | Required | URI | - | ステータスコードのを参照 URI 値 | ○ |
- 第二レベル
適合するものが無い場合は、StatusMessage?、StatusDetail?を使用してもよさそう。
- AuthnFailed?
- InvalidAttrNameOrValue?
- InvalidNameIDPolicy
- NoAuthnContext?
- NoAvailableIDP
- NoPassive?
- NoSupportedIDP
- PartialLogout?
- ProxyCountExceeded?
- RequestDenied?
- RequestUnsupported?
- RequestVersionDeprecated?
- RequestVersionTooHigh?
- RequestVersionTooLow?
- ResourceNotRecognized?
- TooManyResponses?
- UnknownAttrProfile?
- UnknownPrincipal?
- UnsupportedBinding?
認証要求の処理規則 †
以下の処理規則は、レスポンダに、
- このプロトコル交換のすべてのプロファイルにわたって不変の動作として適用される。
- 基礎となるSAML要求 / 応答メッセージに関連する他のすべての処理規則も遵守する。
認証 †
- 認証プロセスを開始するか、プレゼンターと追加のメッセージ交換を行う可能性がある。
- 独自の<AuthnRequest?>メッセージでプレゼンターを別のIdPに誘導(プロキシ)することが含まれる。
Assertion †
<saml:Subject> †
- Assertionには、プレゼンターを表す<saml:Subject>要素が含まれている必要がある。
- リクエストに<saml:Subject>要素が含まれている場合、
レスポンスの<saml:Subject>要素「はこれに強く一致している必要がある。
<NameIDPolicy> †
- 認証したSubjectのIDを<saml:Subject>の<saml:NameID>で返す。
- 種類と形式は、<NameIDPolicy>要素を使用してSPが要求できるが、最終的にはIdPによって決定される。
<saml:AuthnStatement?>要素以下 †
少なくとも1つの<saml:AuthnStatement?>に以下を含める必要がある。
- <saml:SubjectConfirmation?>
- <saml:AudienceRestriction?>
Status > StatusCode? †
なお、認証処理が失敗するなどして、Assertionを提供できない場合は、以下の<StatusCode?>を返す。
- urn:oasis:names:tc:SAML:2.0:status:AuthnFailed?
- urn:oasis:names:tc:SAML:2.0:status:UnknownPrincipal?
レスポンス †
最終的に<AuthnRequest?>に、以下の要素を含む<Response>メッセージで応答しなければならない。
Assertion †
仕様を満たす1つ以上の<Assertion>要素を含む。
Status †
または発生したエラーを説明する<Status>要素を含む。
参考 †
https://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf
3 SAML Protocols
3.1 Schema Header and Namespace Declarations
3.2 Requests and Responses
3.2.1 Complex Type RequestAbstractType
3.2.2 Complex Type StatusResponseType
3.2.2.1 Element <Status>
3.2.2.2 Element <StatusCode>
3.2.2.3 Element <StatusMessage>
3.2.2.4 Element <StatusDetail>
3.3 Assertion Query and Request Protocol
3.3.1 Element <AssertionIDRequest>
3.3.2 Queries
3.3.2.1 Element <SubjectQuery>
3.3.2.2 Element <AuthnQuery>
3.3.2.2.1 Element <RequestedAuthnContext>
3.3.2.3 Element <AttributeQuery>
3.3.2.4 Element <AuthzDecisionQuery>
3.3.3 Element <Response>
3.3.4 Processing Rules
3.4 Authentication Request Protocol
3.4.1 Element <AuthnRequest>
3.4.1.1 Element <NameIDPolicy>
3.4.1.2 Element <Scoping>
3.4.1.3 Element <IDPList>
3.4.1.3.1 Element <IDPEntry>
3.4.1.4 Processing Rules
3.4.1.5 Proxying
3.4.1.5.1 Proxying Processing Rules
3.5 Artifact Resolution Protocol
3.5.1 Element <ArtifactResolve>
3.5.2 Element <ArtifactResponse>
3.5.3 Processing Rules
3.6 Name Identifier Management Protocol
3.6.1 Element <ManageNameIDRequest>
3.6.2 Element <ManageNameIDResponse>
3.6.3 Processing Rules
3.7 Single Logout Protocol
3.7.1 Element <LogoutRequest>
3.7.2 Element <LogoutResponse>
3.7.3 Processing Rules
3.7.3.1 Session Participant Rules
3.7.3.2 Session Authority Rules
3.8 Name Identifier Mapping Protocol
3.8.1 Element <NameIDMappingRequest>
3.8.2 Element <NameIDMappingResponse>
3.8.3 Processing Rules
Tags: :IT国際標準, :認証基盤, :クレームベース認証, :SAML