2016-12-05 140 views
2

我们使用IdentityServer对我们网站上的用户进行身份验证。IdentityServer:帐户激活后登录

当用户注册我们发送的激活邮件,与同时使用GenerateEmailConfirmationTokenAsync

激活工作产生的关键,但我们希望有已经登录的用户激活后。

是否有可能 - 不保存身份服务器之外的敏感数据 - 在激活后登录用户?

回答

2

是;有一种称为IssueLoginCookiehttps://identityserver.github.io/Documentation/docsv2/advanced/owin.html)的OWIN扩展方法,您可以使用该方法发出IdentityServer登录cookie。唯一的要求是此MVC控制器/操作必须在运行IdentityServer的同一管道中运行(因为IdentityServer是发布cookie的那个管道)。然后您需要知道客户端应用的URL以将用户重定向到。

+0

感谢您的回答 - 我可能应该提到我正在使用IdentityServer独立版。所以'IssueLoginCookie' - 据我所知 - 是行不通的。 因此,我最终使用了'GenerateUserToken',它在激活后发回,然后通过'VerifyUserToken'接受为登录流。 – Max