简体   繁体   English

IdentityServer3-如何在PreAuthenticateAsync中获得部分身份?

[英]IdentityServer3 - how to get partial identity in PreAuthenticateAsync?

Question is quite self-describing. 问题是很自我描述的。 There is method: 有方法:

await this.owinContext.Environment.GetIdentityServerPartialLoginAsync();

But in PreAuthenticateAsync method it gets null result. 但是在PreAuthenticateAsync方法中,它将得到null结果。 As a way how to achieve partial identity I use redirect to one of my controllers and back, but is there better way? 作为一种实现部分身份的方法,我使用了重定向到我的一个控制器并返回的方法,但是还有更好的方法吗?

As the method name implies, this hits before any authentication takes place, so it won't have any partial login to give you. 顾名思义,方法会在进行任何身份验证之前命中,因此不会有任何部分登录信息给您。 You should rather make that call in PostAuthenticateAsync which will hit after any authentication step and where you can create context.AuthenticateResult using an appropriate constructor that will either give you a new partial redirect or full result. 您应该宁愿在PostAuthenticateAsync中进行该调用,该调用将在任何身份验证步骤之后触发,您可以在其中创建context.AuthenticateResult并使用适当的构造函数,该构造函数将为您提供新的部分重定向或完整结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM