Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle case when b2c profile contains a '.' #2648

Merged
merged 5 commits into from
May 24, 2021
Merged

Conversation

neha-bhargava
Copy link
Contributor

#2444

Try to handle the scenario when the b2c profile have a '.' character.

@neha-bhargava neha-bhargava marked this pull request as draft May 20, 2021 23:44
{
return new AccountId(str); //Account id is from ADFS; no . in the string
}

return new AccountId(str, elements[0], elements[1]);
return new AccountId(str, str.Substring(0, lastIndexOfDot), str.Substring(lastIndexOfDot + 1));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the fix, splitting the string based on the last .

@@ -117,7 +117,7 @@ public async Task<IEnumerable<IAccount>> GetAccountsAsync(string userFlow)
var accounts = await GetAccountsInternalAsync(ApiIds.GetAccountsByUserFlow).ConfigureAwait(false);

return accounts.Where(acc =>
acc.HomeAccountId.ObjectId.Split('.')[0].EndsWith(
acc.HomeAccountId.ObjectId.EndsWith(
Copy link
Contributor Author

@neha-bhargava neha-bhargava May 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the reason for adding this split here as the ObjectId is obtained after splitting the homeAccountId with the .

@neha-bhargava neha-bhargava marked this pull request as ready for review May 21, 2021 16:59
Copy link
Member

@bgavrilMS bgavrilMS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please add a few unit tests to cover the parsing

Copy link
Contributor

@pmaytak pmaytak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@neha-bhargava neha-bhargava merged commit 95a8137 into master May 24, 2021
@neha-bhargava neha-bhargava deleted the nebharg/2444 branch May 24, 2021 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] [M] MSAL.NET fails if B2C user flows/policies have a name containing a dot (.)
3 participants