【发布时间】:2019-02-17 05:56:29
【问题描述】:
我正在使用 IdentityServer4 并配置了 OpenId Connect 提供程序。我想要做的是将用户名作为查询字符串的一部分传递给提供者,以便提供者预先填写用户名字段。我同时拥有 ADFS 和 Azure AD 提供程序,并且希望此功能可以同时使用。这可能吗?如果可以,怎么办?
在ExternalController 的Challenge 方法中,我添加了我认为应该有效但没有任何作用的方法:
[HttpGet]
public async Task<IActionResult> Challenge(string provider, string returnUrl, string user)
{
if (string.IsNullOrEmpty(returnUrl)) returnUrl = "~/";
if (Url.IsLocalUrl(returnUrl) == false && _interaction.IsValidReturnUrl(returnUrl) == false)
{
throw new Exception("invalid return URL");
}
if (AccountOptions.WindowsAuthenticationSchemeName == provider)
{
return await ProcessWindowsLoginAsync(returnUrl);
}
else
{
var props = new AuthenticationProperties
{
RedirectUri = Url.Action(nameof(Callback)),
Items =
{
{ "returnUrl", returnUrl },
{ "scheme", provider },
{ "login_hint", user }
}
};
return Challenge(props, provider);
}
}
【问题讨论】:
标签: c# asp.net-core asp.net-core-mvc identityserver4 openid-connect