Control Order of Attribute Fields in Azure AD B2C Policies - azure-ad-b2c

Is it possible to control the order in which the attribute fields are displayed when Azure AD B2C generates the html for a signup page? I am familiar with how to style the resulting fields, based on their unique ids if necessary. But I don't see a way of controlling the order in which they're displayed (e.g., so the surname/last name field doesn't appear first).

You can change the field order by:
Editing the built-in policy
Selecting Page UI customization
Selecting Local account sign-up page
Moving the Sign-up attributes list items up and down using the drag icon to left of the attribute name.

Related

Azure AD B2C - get Custom attributes sets by Graph API in the token

After users has done the sign up I want to set some information and receive it in the token when they sign in.
In order to do that I am using custom attributes and setting the value using GraphAPI.
The way I add the custom attributes is as described here:
In your Azure AD B2C tenant, select User flows.
Select your policy (for example, "B2C_1_SignupSignin") to open it.
Select User attributes and then select the custom attribute (for example, "ShoeSize"). Click Save.
Select Application claims and then select the custom attribute.
Click Save.
Those attributes should not be a concern of the user so I am not doing the step number 3 and here is where the problem comes.
I am able to set/get the value of the custom attribute using Graph API but the attribute is not present in the token. If I do the step number 3 then the custom attribute appears in the token.
Is there any workaround to achieve having the custom attributes in the token without having them in the sign up screen?
The link above also says:
The custom attribute is now available in the list of User attributes
and for use in your user flows. A custom attribute is only created the
first time it is used in any user flow, and not when you add it to the
list of User attributes.
Which I believe is the reason why I can't see the attribute in the token, but I though that after setting it with GraphAPI and being able to read it, it would be in the token.
It's not true.
Based on my test, if we don't do the step number 3 but do the step number 4, the custom attribute won't appear in sign up page but still can be included in the token.
Please make sure that you have updated the custom attribute for the signed-in user and use the same user to sign in with that user flow where you didn't do the step number 3 but did the step number 4.
Kindly check it.

Azure B2C Linking Different Permissions to Users

We have a problem where individual user are registered to our application but with permission to see a single set of data. These are all setup as local accounts.
At the moment each user is associated with a single set of data.
We now need to be able to link different sets of data to the same user.
After or during login the user would be presented with the options that are linked to their account and it would remember this throughout their session.
We would also need to be able to add new permissions to an account through an API.
What is the best way of achieving this through Azure B2C ideally without using custom policies if possible.
If you want to insert a page during the authentication journey (sign in) which reads the users access ability, and then allow the user to choose one of these options, and then issue that choice in the token, you will need a custom policy. I am assuming that this list could be different for each user ("options that are linked to their account").
If that list of options is stored on the user object, then it needs to be read from the user, and a dynamic radio box selection be presented to the user.
You need to create a comma delimited list and insert it into a claim, if its already stored as comma delimited, or some other delimited list, then you are already good to go. Otherwise youll need to have B2C send the data to a Rest api to build a comma delimited list.
That claim needs to be shown on the page after 'sign in' in a text box via B2C (hidden with CSS), where javascript on your custom HTML page (configured in B2C) builds a radio box from that list in the hidden text box.
Then the javascript needs to record the choice into another B2C rendered text box. You should then verify at B2C or via Rest api whether the submitted value was valid.
Then issue that value into the token.

How to customize the type of a User Attribute in Azure?

I have created a set of new User Attributes and used them in my new User flow (Policy) in Azure AD B2C.
These attributes are of data type "Boolean" but when I run the user flow I get a textbox input instead of a checkbox.
Usually, I get the possibility to change it on the portal but now I can not find where to do so now.
Have anything changed?
Once the custom user attribute is added, go to page layout. In my case the attribute to add is on the local account registration page, you select where you have added it or want to add it.
Below you will have appeared the user attributes that that part of the flow has (yours should appear). From there you change the type of ticket, you can also change if it is optional or mandatory ...
Go to Azure AD B2C > User flows (policies) > Your user flow > Page layouts.
The User attributes section of the Page layouts page allows you to change the user input type.

Unable to perform reordering of sign-up attributes in Azure B2C sign up page

I would like to rearrange the order of Html Elements which is generated by Azure B2C Sign up page built in attributes.
Like order
Display Name
Family Name
City
State
Country
Please help me by providing the way of rearranging with tab order for accessibility.
You can change the field order by:
Editing the built-in policy
Selecting Page UI customization
Selecting Local account sign-up page
Moving the Sign-up attributes list items up and down using the drag icon to left of the attribute name.
Building on the first answer, if anyone else stumbles across this issue:
Go to your Azure AD B2C
Select User Flows (policies)
Select the policy you wish to edit
Select Page layouts
Select the layout you wish to edit (mine was called Local account sign up page
Edit and re-order the fields as needed

Can Azure AD B2C profile content be customized?

I'm pretty sure the answer is no, but I'll ask anyway.
According to https://azure.microsoft.com/en-us/documentation/articles/active-directory-b2c-reference-ui-customization/, B2C administrators wishing to customize their UI need to
create well-formed HTML5 content with a <div id="api"></div> element (needs to be an empty element) located somewhere in the <body>. This element marks where the Azure AD B2C content is inserted.
It looks like B2C then inserts the information you configure regarding the profile or other policy into that tag.
If you have some tedious HTML - like for example, a list of all universities in the world - you have to enter this information by hand and cannot sort it.
If you're not familiar with the profile, then the question doesn't make sense. When defining the profile, you can create custom fields. MS controls the UI for these custom fields. In their profile UI customization, you can define the way a field is drawn in HTML as Text, DropDown, CheckBox, or Radio Button. For the last three, you have an extremely simplistic UI for entering your data that populates the options.
So, if you have a field for University (which I do) and you have 4,000 entries for Option (which I do), you have to manually enter each option in their UI in the order you wish it to appear. At a minimum, it would be nice to just import this data into the store in which they are keeping this data. At a maximum, it would be really nice you just draw all this HTML myself in my own CSHTML.
Is it/Will it be possible to render those fields from my own HTML/CSHTML?
Is it/Will it be possible to enter the needed data in an easier to use manner (import, direct database manipulation, etc.)?
You could customize the Azure AD B2C UI. And it is possible to render from yor own HTML. But you cannot use JS in that HTML though.
The HTML should be uploaded in a blob and their url should be referred in the Azure AD B2C policies

Resources