邀請流程的工作示例爲here。
在WingTipGamesWebApplication
項目中,InvitationController
控制器類有兩個操作方法,Create
和Redeem
。
Create
操作方法將已簽名的兌換鏈接發送給受邀用戶的電子郵件地址。此兌換鏈接包含此電子郵件地址。它也可以包含邀請碼。
Redeem
操作方法處理兌換鏈接。它將電子郵件地址作爲verified_email聲明在由Wingtip Games應用程序的客戶端密鑰簽名的JWT中(請參閱中類中中的方法),從兌換鏈接到邀請政策。它也可以傳遞邀請碼。
邀請政策可以在here找到。
的邀請政策聲明verified_email權利要求作爲輸入,根據權利要求:
<RelyingParty>
<DefaultUserJourney ReferenceId="Invitation" />
<TechnicalProfile Id="Invitation">
<InputTokenFormat>JWT</InputTokenFormat>
<CryptographicKeys>
<Key Id="client_secret" StorageReferenceId="WingTipGamesClientSecret" />
</CryptographicKeys>
<InputClaims>
<InputClaim ClaimTypeReferenceId="extension_VerifiedEmail" />
</InputClaims>
</TechnicalProfile>
</RelyingParty>
的extension_verifiedEmail權利要求類型,它被聲明爲只讀字段(使得它不能被映射到verified_email輸入聲明:
<BuildingBlocks>
<ClaimsSchema>
<ClaimType Id="extension_VerifiedEmail">
<DisplayName>Verified Email</DisplayName>
<DataType>string</DataType>
<DefaultPartnerClaimTypes>
<Protocol Name="OAuth2" PartnerClaimType="verified_email" />
<Protocol Name="OpenIdConnect" PartnerClaimType="verified_email" />
<Protocol Name="SAML2" PartnerClaimType="http://schemas.wingtipb2c.net/identity/claims/verifiedemail" />
</DefaultPartnerClaimTypes>
<UserInputType>Readonly</UserInputType>
</ClaimType>
</ClaimsSchema>
</BuildingBlocks>
邀請用戶旅程可在here中找到。
的邀請用戶旅程的第二編制步驟執行LocalAccount登記-VerifiedEmail技術簡介:
<UserJourney Id="Invitation">
<OrchestrationSteps>
...
<OrchestrationStep Order="2" Type="ClaimsExchange">
<ClaimsExchanges>
...
<ClaimsExchange Id="LocalAccountRegistrationExchange" TechnicalProfileReferenceId="LocalAccount-Registration-VerifiedEmail" />
</ClaimsExchanges>
</OrchestrationStep>
</OrchestrationSteps>
</UserJourney>
的LocalAccount登記-VerifiedEmail技術簡介與註冊的本地帳戶已驗證電子郵件地址:
<TechnicalProfile Id="LocalAccount-Registration-VerifiedEmail">
<DisplayName>WingTip Account</DisplayName>
<Protocol Name="Proprietary" Handler="Web.TPEngine.Providers.SelfAssertedAttributeProvider, Web.TPEngine, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
<Metadata>
<Item Key="ContentDefinitionReferenceId">api.localaccount.registration</Item>
<Item Key="IpAddressClaimReferenceId">IpAddress</Item>
<Item Key="language.button_continue">Create</Item>
</Metadata>
<CryptographicKeys>
<Key Id="issuer_secret" StorageReferenceId="TokenSigningKeyContainer" />
</CryptographicKeys>
<InputClaimsTransformations>
<InputClaimsTransformation ReferenceId="CreateEmailFromVerifiedEmail" />
</InputClaimsTransformations>
<InputClaims>
<InputClaim ClaimTypeReferenceId="extension_VerifiedEmail" />
</InputClaims>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="extension_VerifiedEmail" Required="true" />
<OutputClaim ClaimTypeReferenceId="newPassword" Required="true" />
<OutputClaim ClaimTypeReferenceId="reenterPassword" Required="true" />
<OutputClaim ClaimTypeReferenceId="displayName" Required="true" />
<OutputClaim ClaimTypeReferenceId="authenticationSource" DefaultValue="localAccountAuthentication" />
<OutputClaim ClaimTypeReferenceId="executed-SelfAsserted-Input" DefaultValue="true" />
<OutputClaim ClaimTypeReferenceId="newUser" />
<OutputClaim ClaimTypeReferenceId="objectId" />
<OutputClaim ClaimTypeReferenceId="sub" />
<OutputClaim ClaimTypeReferenceId="userPrincipalName" />
</OutputClaims>
<ValidationTechnicalProfiles>
<ValidationTechnicalProfile ReferenceId="AzureActiveDirectoryStore-WriteUserByEmail-ThrowIfExists" />
</ValidationTechnicalProfiles>
<UseTechnicalProfileForSessionManagement ReferenceId="SSOSession-AzureActiveDirectory" />
</TechnicalProfile>
要保存對本地帳戶的邀請碼,您必須:
- 添加「extension_InvitationCode」要求權利要求的模式
- 其添加爲輸入聲明到邀請政策
- 其添加爲輸入聲明到LocalAccount登記-VerifiedEmail技術簡介
- 添加它作爲一個持久要求的AzureActiveDirectoryStore-WriteUserByEmail-ThrowIfExist技術簡介
歡迎來到Stack Overflow。你已經嘗試過這麼做了什麼?請回顧[我如何問一個好問題](https://stackoverflow.com/help/how-to-ask)。堆棧溢出不是一種編碼服務。預計您會在發佈之前研究您的問題,並嘗試親自編寫代碼***。如果您遇到* specific *,請返回幷包含[Minimal,Complete和Verifiable示例](https://stackoverflow.com/help/mcve)以及您嘗試的內容摘要,以便我們提供幫助。 – FluffyKitten
@FluffyKitten對此沒有具體說明?第一句話是一個非常具體的問題。並且我可能會添加一個很好的問題:)問候,Mike D. – spottedmahn
@spottedmahn自從我發表評論以來,該問題已被編輯。但僅僅是單獨具體是不夠的 - 在我最初的評論中看到其餘的要求。 – FluffyKitten