首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在OpenID中使用login_hint

在OpenID中使用login_hint
EN

Stack Overflow用户
提问于 2018-01-31 22:45:04
回答 1查看 2.3K关注 0票数 5

我正在尝试将login_hint添加到Azure AD身份验证的OpenID登录请求中。

login_hint添加为属性对我来说不起作用:

代码语言:javascript
复制
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。对于我试图采取的方法,是否需要类似的东西?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-02-03 09:25:18

结果,我不得不将RedirectToIdentityProvider添加到app.UseOpenIdConnectAuthentication

代码语言:javascript
复制
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);
     }
}
票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48544880

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档