如何记住MVC5登录时使用外部供应商 [英] How to remember the login in MVC5 when an external provider is used

查看:87
本文介绍了如何记住MVC5登录时使用外部供应商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们与OWIN MVC5的应用程序,我们使用其他的本地帐户,也可外接登录(谷歌)。当用户使用其本地帐户登录,他可以激活记住他的选择,所以他不会每次登录新。当他与他的谷歌帐户登录,他每次都必须点击新的外部登录按钮为谷歌。

In our MVC5-application with OWIN, we use additional to the local accounts also external logins (google). When the user logs in with its local account, he can activate the option to remember him, so he has not to log-in every time newly. When he logs in with his Google-account, he every time must click newly on the external login-button for google.

有一个内置的选项来激活记住我-option也为外部登录?还是有添加此功能以安全的方式?

Is there a built-in option to activate the "remember me"-option also for external logins? Or is there a secure way to add this feature?

推荐答案

您只需要IsPersistent设置为true,当你在用户身份登录做到这一点(你也想加入某种记得我复选框为外部的流量大概为好)

You just need to set IsPersistent to true to accomplish this when you sign in the user identity (you would want to also add some kind of remember me checkbox for the external flow probably as well)

        AuthenticationManager.SignIn(new AuthenticationProperties { IsPersistent = <rememberMe> }, <userIdentity>);

这篇关于如何记住MVC5登录时使用外部供应商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆