如何将ASP.NET Identity与您自己的自定义表一起使用 [英] How to Use ASP.NET Identity with your own Custom Table

查看:45
本文介绍了如何将ASP.NET Identity与您自己的自定义表一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的表,其中UserID为int密码为文本,Roles为文本(逗号分隔). 我可以自定义ASP.NET身份结构以与表一起使用吗?

I have a very simple table that has UserID as int Password as text and Roles as text(comma separated). Can i customize ASP.NET Identity structure to use it with my table?

推荐答案

是的,您可以使Identity可以与您的结构一起使用.您必须实现IPasswordValidator才能进行密码使用的任何散列(我希望将其进行散列).另外,您还必须实现IUserStore来指向您的表.并且IUserRoleStore还必须实现以从CSV列表中继承角色.

Yes, you can make Identity work with your structure. You'll have to implement IPasswordValidator to take whatever hashing (I hope it is hashed) is used for your password. Also you'll have to implement IUserStore to point to your table. And IUserRoleStore also have to be implemented to take roles from your CSV list.

以下是该体系结构的概述: http://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity

Here is an overview of the architecture: http://www.asp.net/identity/overview/extensibility/overview-of-custom-storage-providers-for-aspnet-identity

这篇关于如何将ASP.NET Identity与您自己的自定义表一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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