AzureAD / microsoft-authentication-library-for-java

Microsoft Authentication Library (MSAL) for Java http://aka.ms/aadv2
MIT License
282 stars 137 forks source link

Fetch the same userInfo as in ADAL4j #753

Closed balishreya closed 7 months ago

balishreya commented 7 months ago

As @xiaozhon mentioned in https://github.com/AzureAD/microsoft-authentication-library-for-java/issues/642, we need a one to one mapping from the displayId to some field in MSAL. We understand this is not the best practice since the username in Azure could change but need this for backwards compatibility reasons.

Could you confirm that in MSAL, we would need to perform this logic to get this one-to-one mapping? (similar to https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/b35a4b30c4501df50466cf85b87acbd53a6228d3/src/main/java/com/microsoft/aad/adal4j/UserInfo.java#L134)

       // idToken.preferred_email should be the same as upn
        if (!StringHelper.isBlank(idtoken.preferred_username) {
            displayableId =  idtoken.preferred_username
        }
        else if (!StringHelper.isBlank(idtoken.email)) {
            displayableId = idtoken.email
      }

Originally posted by @balishreya in https://github.com/AzureAD/microsoft-authentication-library-for-java/issues/642#issuecomment-1830216378

Avery-Dunn commented 7 months ago

Closing this thread since the conversation continued in the original: https://github.com/AzureAD/microsoft-authentication-library-for-java/issues/642#issuecomment-1830216378

Feel free to reopen if there are any related questions or if that other conversation leads to some action items we should track.