Итак, суть в том, что вы также должны переопределить метод GetIdentityTokenClaimsAsync в классе, производном от DefaultClaimsProvider, если вы хотите иметь некоторые дополнительные утверждения как часть вашего идентификационного токена.
нтересно, можно ли распространять утверждение о неисполнении или вообще любое другое утверждение, выданное Identity Server 3, на AAD B2C и сделать его частью токена, выданного Azure AD B2C? У нас должен быть оригинальный идентификатор на стороне клиента, и все, что мы можем получить по заявкам sub и oid, - это идентификатор учетной записи пользователя AAD B2C. Я также хотел бы сделать то же самое с заявкой на роль. Любая помощь приветствуется.
[EDITED]
Вот как выглядит TechnicalProfile моей конфигурации Identity Server в пользовательской политике (TrustFrameworkExtensions.xml):
<TechnicalProfile Id="IdentityServerProfile">
<DisplayName>IdentityServer</DisplayName>
<Description>Login with your IdentityServer account</Description>
<Protocol Name="OpenIdConnect"/>
<OutputTokenFormat>JWT</OutputTokenFormat>
<Metadata>
<Item Key="METADATA">https://{identity_server_hostname}/identity/.well-known/openid-configuration</Item>
<Item Key="ProviderName">https://{identity_server_hostname}/identity</Item>
<Item Key="client_id">00000000-0000-0000-0000-000000000000</Item>
<Item Key="IdTokenAudience">00000000-0000-0000-0000-000000000000</Item>
<Item Key="response_types">code</Item>
<Item Key="scope">openid profile customScope</Item>
<Item Key="UsePolicyInRedirectUri">false</Item>
<Item Key="AccessTokenResponseFormat">json</Item>
<Item Key="HttpBinding">POST</Item>
</Metadata>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="B2C_1A_IdentityServerAppSecret"/>
</CryptographicKeys>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="IdentityServer" />
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="name" />
<OutputClaim ClaimTypeReferenceId="identityProvider" DefaultValue="tid" />
<OutputClaim ClaimTypeReferenceId="socialIdpUserId" PartnerClaimType="sub" />
</OutputClaims>
<OutputClaimsTransformations>
<OutputClaimsTransformation ReferenceId="CreateRandomUPNUserName"/>
<OutputClaimsTransformation ReferenceId="CreateUserPrincipalName"/>
<OutputClaimsTransformation ReferenceId="CreateAlternativeSecurityId"/>
</OutputClaimsTransformations>
<UseTechnicalProfileForSessionManagement ReferenceId="SM-Noop"/>
</TechnicalProfile>
А вот оригинальный журнал из Application Instights из журнала с заданным значением correlationId:
{
"TenantId": "{tenant} .onmicrosoft.com", "PolicyId": "B2C_1A_signup_signin_capcom", "RedirectUri": "HTTP: // локальный: 3000 /"," Дополнительные параметры ": {
"client_info": "1", "x-client-SKU": "MSAL.JS", "x-client-Ver": "0.1.5", "client-request-id": "a0ef9d95-ba21-4796 -ad65-bc9e2b8c5e89 "}," Nonce ":" bf198ee6-e084-433d-885c-2bd8f0292b3d "," State ":" 7f732141-498e-4445-9efe-9b0d54178ef6 "," ClientId "- 852-ff2": 012cf "):" ClientId "- 852-ff2: 0 9bca-054d6201ac00 "," ResponseType ":" id_token "," ResponseMode ":" фрагмент "," ResponseRedirector ": {
"URI":»HTTP: // локальный: 3000 /"," D ": false," WF ": true," R ": false," S ": false}," AppModelVersion ": 1," ScopedProviders ": [
]}
Что-то, что я заметил, и что я нашел странным, это значение ResponseType. В нашем TechnicalProfile установлен код, а здесь его значение - id_token.
[ИЗД. 2] Заявка на socialIdpUserId, наконец, проходит. Ниже также есть ответ, в чем проблема. Теперь у меня все еще есть проблема с firstName, lastName и displayName. Я следовал тому же шаблону, что и для socialIdpUserId, но вижу только значения по умолчанию. Вот мои конфигурации для них:
1) Определение типов претензий:
<ClaimType Id="displayName">
<DisplayName>Display Name</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="unique_name" />
<Protocol Name="OpenIdConnect" PartnerClaimType="displayName" />
<Protocol Name="SAML2" PartnerClaimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" />
</DefaultPartnerClaimTypes>
<UserHelpText>Your display name.</UserHelpText>
<UserInputType>TextBox</UserInputType>
</ClaimType>
...
<ClaimType Id="givenName">
<DisplayName>Given Name</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="given_name" />
<Protocol Name="OpenIdConnect" PartnerClaimType="given_name" />
<Protocol Name="SAML2" PartnerClaimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" />
</DefaultPartnerClaimTypes>
<UserHelpText>Your given name (also known as first name).</UserHelpText>
<UserInputType>TextBox</UserInputType>
</ClaimType>
<ClaimType Id="surname">
<DisplayName>Surname</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="family_name" />
<Protocol Name="OpenIdConnect" PartnerClaimType="family_name" />
<Protocol Name="SAML2" PartnerClaimType="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" />
</DefaultPartnerClaimTypes>
<UserHelpText>Your surname (also known as family name or last name).</UserHelpText>
<UserInputType>TextBox</UserInputType>
</ClaimType>
И вывод претензий в технический профиль для моего IdP:
<TechnicalProfiles>
<TechnicalProfile Id="CapcomProfile">
...
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="displayName" />
<OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="firstName" DefaultValue="No" />
<OutputClaim ClaimTypeReferenceId="surname" PartnerClaimType="lastName" DefaultValue="Name" />
...
И, наконец, определение выхода RP:
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="displayName" PartnerClaimType="displayName" />
<OutputClaim ClaimTypeReferenceId="givenName" PartnerClaimType="givenName" />
<OutputClaim ClaimTypeReferenceId="surname" PartnerClaimType="surname" DefaultValue="Not found in IdP" />
...
Какие-либо предложения?