CommunityToolkit / CommunityToolkit/Graph-Controls

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

未关闭
#185 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
Area: Providers bug :bug:
主要语言
C#
星标
156
派生
38
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。