How to create a custom token for a claim

CPO 61 Reputation points
2024-02-21T12:49:39.8333333+00:00

I want to be able to create an attribute in a user for Home Directory then create a token to assign as an optional claim t be sent in the JWT so an application can use the information. How do i configure this?

Microsoft Security Microsoft Entra Microsoft Entra ID
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. James Hamil 27,211 Reputation points Microsoft Employee Moderator
    2024-02-21T21:16:55.0766667+00:00

    Hi @CPO , you can use Azure AD and specify your own claim type and value. Here are the steps to configure this:

    1. In the Azure portal, navigate to your Azure AD tenant and select "App registrations" from the left-hand menu.
    2. Select the application that you want to configure optional claims for.
    3. Under "Manage", select "Token configuration".
    4. Under "Optional claims", select "Add optional claim".
    5. Select "ID" as the token type.
    6. In the "Name" field, enter the name of your custom claim type. For example, "HomeDirectory".
    7. In the "Source" field, select "Attribute".
    8. In the "Source attribute" field, enter the name of the attribute in the user object that you want to use as the value for the claim. For example, "homeDirectory".
    9. Select "Save" to save your changes.

    Once you have configured your optional claim, it will be included in the JWT that is issued by Azure AD when a user signs in to your application. Your application can then use the information in the claim to provide personalized experiences for the user. More information here.

    Please let me know if you have any questions and I can help you further.

    If this answer helps you please mark "Accept Answer" so other users can reference it.

    Thank you,

    James

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.