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

Aperta
#185 1 commento 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
azure, csharp

Direzione di ricerca

Apri MsalProvider.cs e ispeziona i costruttori in cui ogni scope viene passato tramite Select(s =\u003e s.ToLower()). Conferma come l'array degli scope viene utilizzato dal flusso di autenticazione. Il lavoro è completato quando viene preservata la distinzione tra maiuscole e minuscole originale di ogni scope, così che lo scope con distinzione tra maiuscole e minuscole venga accettato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
C#
Stelle
156
Fork
37
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CommunityToolkit/Graph-Controls

Tutte le issue di CommunityToolkit/Graph-Controls

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.