How to trim a character in Azure AD SAML claims

Akshay 0 Reputation points
2023-09-07T21:09:04.78+00:00

I have a SAML application which is using emailaddress claim. I have some users who have ' (single quote) in their email addresses and I would like to remove through claim transformations.

For example john.sn**'**ow@google.com should be sent as john.snow@google.com in SAML assertion.

As per the MS official claim transformations article, it may be possible through regexreplace() but the syntax looks so confusing. Can this be achieved at all?

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
16,692 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shweta Mathur 19,946 Reputation points Microsoft Employee
    2023-09-12T07:11:42.2166667+00:00

    Hi @Akshay

    Thanks for reaching out.

    You can use the regexReplace() function to transform the mail address.

    You can use below regax to remove the single Quote and concatenate the email address.

    ^(?'firstpart'[^']+)'(?'SingleQuote')|(?'lastpart'[\w\.-]+@[\w\.-]+)$
    
    
    

    User's image

    Hope this will help.

    Thanks,

    Shweta


    Please remember to "Accept Answer" if answer helped you.

    0 comments No comments