OpenId连接身份验证属性



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

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

var scheme = OpenIdConnectDefaults.AuthenticationScheme;
var properties = new AuthenticationProperties { RedirectUri = redirectUrl };
properties.Items["data1"] = "[possiblySensitiveData]";
return Challenge(properties, scheme);

当用户从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中的标准数据保护系统。

相关内容

最新更新