OpenId Connect 身份验证属性

OpenId Connect Authentication Properties

在我的应用程序中,我将用户重定向到 Azure B2C 屏幕,以便他们可以更改他们的帐户。

我使用以下代码将用户传递给 B2C,其中包括对 properties.Items 的引用,我用一个值填充它:

var scheme = OpenIdConnectDefaults.AuthenticationScheme;
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };

properties.Items["data1"] = "[possiblySensitiveData]";

return Challenge(properties, scheme);

当用户 returns 从 Azure B2C 屏幕访问我的应用程序时,我可以从 data1 检索值。

是否有可能窃听的人也可以检索存储在 ``data1``` 中的值?或者以这种方式传递的任何值是否默认加密?

OpenIdConnectHandler加密数据:https://github.com/dotnet/aspnetcore/blob/78ab4bd673c1040cf59400be76daf395062bc6a7/src/Security/Authentication/OpenIdConnect/src/OpenIdConnectHandler.cs#L450.

message.State = Options.StateDataFormat.Protect(properties);

此数据保护程序在此处设置:https://github.com/dotnet/aspnetcore/blob/52eff90fbcfca39b7eb58baad597df6a99a542b0/src/Security/Authentication/OpenIdConnect/src/OpenIdConnectPostConfigureOptions.cs#L46-L48

var dataProtector = options.DataProtectionProvider.CreateProtector(
    typeof(OpenIdConnectHandler).FullName!, name, "v1");
options.StateDataFormat = new PropertiesDataFormat(dataProtector);

它使用 ASP.NET Core 中的标准数据保护系统。