MsalProvider.cs ctors convert scope strings to lowercase but should not do that!

Aberta
#185 1 comentário 1 reação 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
1/5
Tempo estimado
Menos de uma hora
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
azure, csharp
Domínio
authentication

Direção de pesquisa

Abra MsalProvider.cs e inspecione os construtores nos quais cada scope é passado por Select(s =\u003e s.ToLower()). Confirme como o array de scopes é usado pelo fluxo de autenticação. Considera-se concluído quando a capitalização original de cada scope é preservada para que o scope que diferencia maiúsculas de minúsculas seja aceito.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Area: Providers bug :bug:

Toolkit Version 7.1.1

MsalProvider.cs Contructors convert the scope arrays to lowercase:

Scopes = scopes.Select(s => s.ToLower()).ToArray() ?? new string[] { string.Empty };

It should not do this because OpenID specs define scopes as CASE SENSITIVE.
https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
"Multiple scope values MAY be used by creating a space delimited, case sensitive list of ASCII scope values."

https://tools.ietf.org/html/rfc6749#section-3.3
"The value of the scope parameter is expressed as a list of space-delimited, case-sensitive strings. The strings are defined by the authorization server. If the value contains multiple space-delimited strings, their order does not matter, and each string adds an additional access range to the requested scope."

I'm running an .NET Core 6 Azure Web App Api with an case sensitive scope in the AAD app registration. Using standard MSAL PublicClientApplication runs fine with that. Using the MsalProvider wrapper of the community toolkit breaks this, because the "lowercased" scope is not accepted by Microsoft.IdentityModel.Tokens.SecurityToken:

IDX10214: Audience validation failed. Audiences: 'https://abce.de/webapp-abcd.azurewebsites.net'. Did not match: validationParameters.ValidAudience: 'https://abce.de/WebApp-abce.azurewebsites.net'

Please not the uppercase 'W' in the scope.

Earlier versions of MSAL also had that bug and fixed it:
https://github.com/AzureAD/microsoft-authentication-library-for-objc/issues/395
https://github.com/AzureAD/microsoft-authentication-library-for-js/issues/1922

Best Regards,
Torsten

Linguagem predominante
C#
Estrelas
156
Forks
37
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

  • Sem Dockerfile nem arquivo Docker Compose
  • Tem um modelo de pull request
  • Sem guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de CommunityToolkit/Graph-Controls

Todas as issues de CommunityToolkit/Graph-Controls

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.