我正在尝试将login_hint添加到Azure AD身份验证的OpenID登录请求中。
将login_hint添加为属性对我来说不起作用:
var properties = new AuthenticationProperties();
properties.RedirectUri = "someCallbackUrl";
properties.Dictionary.Add("login_hint ", "SomeUsername");
AuthenticationManager.Challenge(properties, OpenIdConnectAuthenticationDefaults.AuthenticationType);将login_hint手动添加到查询字符串...&login_hint=SomeUsername至少向我证明了这样的功能是存在的:-)
我知道如果我要使用GoogleOAuth2AuthenticationProvider,我将不得不重写它自己的like so。对于我试图采取的方法,是否需要类似的东西?
发布于 2018-02-03 09:25:18
结果,我不得不将RedirectToIdentityProvider添加到app.UseOpenIdConnectAuthentication中
Notifications = new OpenIdConnectAuthenticationNotifications()
{
RedirectToIdentityProvider = (context) =>
{
string login_hint = context.OwinContext.Authentication.AuthenticationResponseChallenge.Properties.Dictionary["login_hint"];
context.ProtocolMessage.LoginHint = login_hint;
return Task.FromResult(0);
}
}https://stackoverflow.com/questions/48544880
复制相似问题