シングルサインオン(SSO)- User Field と NameID Attribute の理解Summary NameID とは SAML 2.0 では、NameID は SAML Response の <saml2:Subject> ブロック内の必須要素です。これは Identity Provider(IdP)によって送信され、認証するユーザーのプライマリ識別子として機能します。NameID は有効な SAML assertion に常に存在し、SSO ログイン時に一致するユーザーレコードを検索するために ServiceNow が使用するデフォルト値です。 以下の SAML Response を参照すると、NameID の値は「abel.tuter@example.com」です。 <saml2:Subject> <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"> abel.tuter@example.com </saml2:NameID> </saml2:Subject> SAML Attributes とは SAML Attributes は、SAML Response の <saml2:AttributeStatement> ブロックに含まれるオプションのキーと値のペアです。これらはユーザーに関する追加情報を保持し、SSO User Provisioning、およびこの場合は Authentication のために、[sys_user] テーブルのフィールドにマッピングできます。 以下の SAML Response では、IdP によって提供される属性は「firstName」、「lastName」、「email」、および「employeeNumber」です。 <saml2:AttributeStatement xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"> <saml2:Attribute Name="firstName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"> Abel </saml2:AttributeValue> </saml2:Attribute> <saml2:Attribute Name="lastName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"> Tuter </saml2:AttributeValue> </saml2:Attribute> <saml2:Attribute Name="email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"> abel.tuter@example.com </saml2:AttributeValue> </saml2:Attribute> <saml2:Attribute Name="employeeNumber" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"> EMP007 </saml2:AttributeValue> </saml2:Attribute> </saml2:AttributeStatement> ユーザーフィールド と NameID 属性 ユーザーフィールド 一致するユーザーレコードを検索するときに、インスタンスが [sys_user] テーブルのどのフィールドを照会するかを指定します。 上記の SAML Response XML では、NameID の値が「abel.tuter@example.com」であるため、[sys_user] テーブルで照合するフィールドとして「User Field」を「email」に設定することが考えられます。 NameID 属性 デフォルトの NameID 値を上書きし、NameID 値の代わりに <AttributeStatement> の特定の属性を識別子として使用するようインスタンスに指示します。つまり、その属性が見つからない場合、または空の値が含まれている場合、インスタンスはユーザーを見つけることができないため、SSO 認証は失敗します。 上記の SAML Response XML には、さまざまな属性(名、姓、メールアドレス、従業員番号)が含まれているため、いくつかのシナリオを確認します。 シナリオ #1 - 「email」NameID 属性の使用 「email」という名前の属性にはユーザーのメールアドレスが含まれているため、この属性値を使用して [sys_user] テーブルの「email」フィールドと照合できます。 <saml2:AttributeStatement xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"> ... <saml2:Attribute Name="email" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"> abel.tuter@example.com </saml2:AttributeValue> ... </saml2:AttributeStatement> シナリオ #2 - 「employeeNumber」NameID 属性の使用 「employeeNumber」という名前の属性にはユーザーの従業員番号が含まれているため、この属性値を使用して [sys_user] テーブルの「Employee number」フィールドと照合できます。 <saml2:AttributeStatement xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion"> ... <saml2:Attribute Name="employeeNumber" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"> <saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string"> EMP007 </saml2:AttributeValue> </saml2:Attribute> </saml2:AttributeStatement>