Azure-Samples / Azure-Samples/ms-identity-blazor-server

Sample for GetAccountAsync() not using correct claims

Open
#15 1 comment 0 reactions 1 assignee Claimed by @v-michaelmi View on GitHub
Dominant language
C#
Stars
57
Forks
34
PR merge metrics
No merged PRs in 30d

Description

> Please provide us with the following information:
> ---------------------------------------------------------------

### This issue is for a: (mark with an `x`)
```
- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [X ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
```

### Minimal steps to reproduce
- Clone Repo
- Follow steps

### Any log messages given by the failure
Using the sample, the `GetAccountIdentifier` method does not check the correct claims and no accounts are retrieved when using that identifier

```csharp
private string GetAccountIdentifier(AuthenticationState authState)
{
if (authState.User.Identities.First().Claims.Where(c => c.Type == "uid").Count() == 0 ||
authState.User.Identities.First().Claims.Where(c => c.Type == "utid").Count() == 0)
{
return null;
}
//return "." which is account identifier;
return authState.User.Identities.First().Claims.Where(c => c.Type == "uid").First().Value + "." +
authState.User.Identities.First().Claims.Where(c => c.Type == "utid").First().Value;
}
````
### Expected/desired behavior
GetAccountAsync() to return account

### OS and Version?
Windows 11

> Thanks! We'll be in touch soon.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.