Azure active directory 向Azure B2C登录url添加其他查询参数
我正在将Azure B2C实现到.NET MVC应用程序中,我需要向登录url添加一个额外的查询参数 下面是我如何在startup.cs中设置它的Azure active directory 向Azure B2C登录url添加其他查询参数,azure-active-directory,azure-ad-b2c,azure-ad-b2b,openconnect,Azure Active Directory,Azure Ad B2c,Azure Ad B2b,Openconnect,我正在将Azure B2C实现到.NET MVC应用程序中,我需要向登录url添加一个额外的查询参数 下面是我如何在startup.cs中设置它的 var openIdConnectAuthenticationOptions = new OpenIdConnectAuthenticationOptions { // Generate the metadata address using the tenant and policy infor
var openIdConnectAuthenticationOptions = new OpenIdConnectAuthenticationOptions
{
// Generate the metadata address using the tenant and policy information
MetadataAddress = String.Format(Globals.WellKnownMetadata, Globals.Tenant, Globals.DefaultPolicy),
// These are standard OpenID Connect parameters, with values pulled from web.config
ClientId = Globals.ClientId,
RedirectUri = Globals.RedirectUri,
PostLogoutRedirectUri = Globals.RedirectUri,
// Specify the callbacks for each type of notifications
Notifications = new OpenIdConnectAuthenticationNotifications
{
RedirectToIdentityProvider = OnRedirectToIdentityProvider,
AuthorizationCodeReceived = OnAuthorizationCodeReceived,
AuthenticationFailed = OnAuthenticationFailed
},
// Specify the claim type that specifies the Name property.
TokenValidationParameters = new TokenValidationParameters
{
NameClaimType = "name",
ValidateIssuer = false
},
// Specify the scope by appending all of the scopes requested into one string (separated by a blank space)
Scope = $"openid",
ResponseType = "id_token",
};
app.UseOpenIdConnectAuthentication(
openIdConnectAuthenticationOptions
);
当有人试图访问[授权]标记的页面时,它会将他们发送到此b2c url:
但是,我需要在末尾添加一个额外的查询参数“&appId=000-000-000”,因此生成的登录URL为:
&appId=000-000-000
我将如何执行此操作?恐怕您无法添加
appId
参数,但我建议使用状态
参数。您可以使用此参数将appid的值作为请求的一部分发送,并在响应中返回
有关更多详细信息,请参阅。感谢您的回复-如何在MVC的状态参数中设置它?我试试看。有一个具有自定义策略的b2c实例需要该参数,如果我使用javascript并手动附加该参数,则b2c页面将在MVC中加载,但没有该参数则不会加载。以下是示例: