我们有自己的OpenID Connect Provider.我们希望使用Owin中间件在身份验证请求中传递自定义查询参数.我们无法找到使用Microsoft.Owin.Security.OpenIdConnect程序集实现此方法的方法.甚至我们也找不到如何向Authentication Request添加标准请求参数(例如" login_hint parameter").
例如,Google有" login_hint "和" hd "参数(https://developers.google.com/accounts/docs/OAuth2Login#sendauthrequest),我们希望拥有几乎相同的参数.但我们甚至找不到如何使用Owin将这些参数发送给Google.试过这段代码:
var googleOptions = new GoogleOAuth2AuthenticationOptions()
{
ClientId = "...",
ClientSecret = "...",
};
app.UseGoogleAuthentication(googleOptions);
...
public ActionResult ExternalLogin(string provider)
{
var ctx = Request.GetOwinContext();
var properties = new AuthenticationProperties();
properties.Dictionary.Add("login_hint ", "myemail@gmail.com");
properties.Dictionary.Add("hd", "hd");
ctx.Authentication.Challenge(properties, provider);
return new HttpUnauthorizedResult();
}
Run Code Online (Sandbox Code Playgroud)
但是生成身份验证请求网址时将不使用" login_hint "和" hd "参数.
非常感谢任何帮助解决这个问题.