AspNetUserLogins表标识 [英] The AspNetUserLogins table Identity

查看:263
本文介绍了AspNetUserLogins表标识的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

AspNetUserLogins的用途是什么?是否可以存储用户的登录信息?然后如何用该数据更新该表?

What is the AspNetUserLogins for? Is It to store the logins from the user? How can I then update this table with that data?

推荐答案

AspNetUserLogins的用途是什么? 在Asp.net Identity中,Identity系统使用AspNetUserLogins表保存有关第三方/外部登录的信息,例如通过Google,Facebook,Twitter等登录到您的网站的用户.AspNetUsers表是主表存储用户信息,它通过UserId -> AspNetUsers.Id链接到AspNetUserLogins.

What is the AspNetUserLogins for? In Asp.net Identity, the Identity system uses the AspNetUserLogins table to hold information about 3rd party/external logins, for example users who login into your site via Google, Facebook, Twitter etc. The AspNetUsers table is the primary table to store user information, this is linked to AspNetUserLogins via UserId -> AspNetUsers.Id.

例如,如果用户通过Facebook登录到您的网站,则LoginProvider是提供登录信息的服务的名称,因此在这种情况下," Facebook "中的ProviderKey是与Facebook上的用户相关联的唯一Facebook密钥.

For example if the user logs into your site via Facebook, then the LoginProvider is the name of the service which provided the login, so in this case "Facebook", the ProviderKey is a unique Facebook key associated with the user on Facebook.

Asp.net外部身份验证提供程序使用此表.

This table is used by the Asp.net external authentication providers.

是否要存储用户的登录信息? 不,不是真的,它的用法如上所述

Is it to store the logins from the user? No not really, it is used as explained above

然后如何使用该数据更新该表? 您不更新此表中的数据,通常在用户通过外部提供程序登录时,在对用户进行身份验证之后,提供程序将返回ClaimsIdentity,该表具有用户声明,其中之一是用户的唯一ID.在外部提供程序中,此信息将在此表中自动更新.

How can I then update this table with that data? You don't update the data in this table, usually when a user logs in via external provider, after user has been authenticated, the provider returns a ClaimsIdentity, which has users claims and one of those is a unique id of the user in the external provider, this gets automatically updated in this table.

此处详细了解

这篇关于AspNetUserLogins表标识的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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