Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling terms and conditions at Azure AD B2C registration

I'm implementing Azure AD B2C in my public facing app and with this approach, new user registration is essentially taking place "outside" of my app on Azure.

How can I enforce users agreeing to my terms and conditions? In other words, I'd like there to be a checkbox and it must be mandatory for users to check it to proceed with the registration process. If the user doesn't check the checkbox, registration should not take place.

I understand through UI customization I can change the appearance of the registration page and there can be a highlighted statement that reads:

By clicking Register, you're agreeing to our terms and conditions.

I think it would be better if there was a mandatory checkbox though. Is this doable with Azure AD B2C?

UPDATE: In Step 5, I'm not seeing "Custom Attributes" -- here's the screen shot: enter image description here

UPDATE 2: Not allowing me to save after uploading json file for override. enter image description here

like image 337
Sam Avatar asked Mar 06 '23 04:03

Sam


1 Answers

You can create a custom attribute that prompts for the end-user agreement.

E.g. Create a custom attribute called AgreedToTermsAndConditions of type String.

For built-in policies

To display this custom attribute as a checkbox that must be checked during sign-up:

  1. In the Azure portal, open Azure AD B2C and then select Sign-up or sign-in policies.
  2. In Sign-up or sign-in policies, select the sign-up or sign-in policy.
  3. For the selected policy, select Edit.
  4. In Edit policy, select Sign-up attributes.
  5. In Select sign-up attributes, select the custom attribute and then select OK.
  6. In Edit policy, select Page UI customization.
  7. In Page UI customization, select Local account sign-up page.
  8. In Local account sign-up page, select the sign-up attribute.
  9. In Edit attribute, select No for Optional and CheckboxMultiSelect for User input type and then select OK.
  10. In Local account sign-up page, select OK.
  11. Repeat steps 7-10 for Social account sign-up page.
  12. In Page UI customization, select OK.
  13. In Edit policy, select Save.
  14. In Edit policy, select Language customization.
  15. In Language customization, select Enable language customization if it isn't already enabled.
  16. In Language customization, select the default language.
  17. For the selected language, expand Local account sign-up page and upload a resource file such as the following example.
  18. Repeat step 16 for Social account sign-up page.
  19. Repeat steps 16-18 for other enabled languages.

An example of the resource file:

{
  "LocalizedCollections": [
    {
      "ElementType": "ClaimType",
      "ElementId": "extension_AgreedToTermsAndConditions",
      "TargetCollection": "Restriction",
      "Override": true,
      "Items": [
        {
          "Name": "I agree to your terms and conditions",
          "Value": "True"
        }
      ]
    }
  ]
}

(Phew!)

You can also set the item value to a date string (e.g. "2018-04-01") or a version string (e.g. "v1") if you are wanting to store the date or version of the terms and conditions.

For custom policies

Updated on 23 May 2018

The Manage user access in Azure AD B2C article describes how you can prompt for the end-user agreement during sign-up and, subsequently, during sign-in if the end user hasn't accepted the latest or new terms and conditions.

like image 95
Chris Padgett Avatar answered Mar 24 '23 07:03

Chris Padgett