Custom Policies
Here be dragons.
To quote Microsoft: Don’t use custom polices if you don’t really need to.
It adds a lot of complexity to the flows, and an in-depth understanding of the identity experience framework is required to work with custom policies.
That said - I will try and simplify what you need to consider, since the initial setup has been done.
The three sections which you may need to interact with are:
- Email Templates
- Custom Page Layouts, which includes enabling JavaScript, and
- User Claims
With every custom policy, you need a Base-policy, an Extension Policy, and your custom Policy.
The Base and Extension policies have already been set up, and are referenced by the other custom policies. Do not change them without speaking approval of the ARB.
You will need to edit the policy XML in Visual Studio Code. Clone the Verzzo repo in TFS
Copy the Existing TreatlyCustomSI.xml or TreatleyCustomPR.xml policies to create new SI or PR policies.
Change the file name, PolicyId and PublicPolicyUri in the TrustFrameworkPolicy element to reflect your policy name. Be sure to prefix the name with B2C_1A_
Email Templates
Creating the SendGrid Templates
In order to send custom email templates, you will need to create a new email template in SendGrid. Navigate to the Azure Portal, and search for SendGrid Accounts.
You will see YesStorMailing. This is the Azure-integrated SendGrid account for the Group.
Select the YesStoreMailing link, and then click on the Manage button at the top.
This is where you will create and manage the email templates. Make sure to save the template ID of the Dynamic template for use in the Custom Policy XML.
Implementing the templates in the Custom Policy XML
Within your custom policy XML, look for the GenerateEmailRequestBody
ClaimsTransformation under the ClaimsTransformations tag.
Within the InputParameters, look for the template_id
Input Parameter, and change it to the ID of the template created in the step above.
<ClaimsTransformations>
<ClaimsTransformation Id="GenerateEmailRequestBody" TransformationMethod="GenerateJson">
<InputClaims>
<InputClaim ClaimTypeReferenceId="email" TransformationClaimType="personalizations.0.to.0.email" />
<InputClaim ClaimTypeReferenceId="otp" TransformationClaimType="personalizations.0.dynamic_template_data.otp" />
<InputClaim ClaimTypeReferenceId="email" TransformationClaimType="personalizations.0.dynamic_template_data.email" />
</InputClaims>
<InputParameters>
<!-- Update the template_id value with the ID of your SendGrid template. -->
<InputParameter Id="template_id" DataType="string" Value="d-cc1066aa36db4908bb263b34c7341b2b"/>
<InputParameter Id="from.email" DataType="string" Value="Treatly@Verzzo.com"/>
<!-- Update with a subject line appropriate for your organization. -->
<InputParameter Id="personalizations.0.dynamic_template_data.subject" DataType="string" Value="Verzzo account email verification code for Treatly"/>
</InputParameters>
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="emailRequestBody" TransformationClaimType="outputClaim"/>
</OutputClaims>
</ClaimsTransformation>
</ClaimsTransformations>
Custom Page Layouts
If you need to host custom page Html for your user flows / policies, you will have to design and host your own markup. use This article to find out more on how to build your custom pages.
Once you have the custom page built and hosted, you need need to edit your custom policy custom policy you have copied higher up in this article.
Within your custom policy XML, look for the api.signuporsignin
ContentDefinition under the ContentDefinitions tag.
Change the LoadURI to the location of the location of the custom page layout you have created.
Next Step – User Flow Custom Page Layouts