ASP.NET Identity User and Roles in Multisite

William

I am trying to create a permissions system in an ASP.NET MVC Application. I have been learning the newest Identity framework - here are my requirements:

  1. A set of Hierarchical Roles for each set of functionality. So, for instance, there might be the following roles:
    • Inherit
    • Reader
    • Editor
    • Manager
    • Administrator
  2. Each user would have one of those roles for each module (e.g. Events, Pages, etc.)
  3. Users can be members of a security group. Each security group can be assigned a role directly and then all users in that group (who have not been explicitly assigned that permission) will inherit that role.
  4. Multi-tenant site: each user has a set of sites which they are a member of. In the context of each site, they have a complete set of permissions which can be assigned by the site admin.

Through extending ASP.NET Identity, is it going to be possible for me to accomplish all of this? Or should I be building something custom from the ground-up?

Chris Pratt

9,999 times out of 10,000 implementing your own authentication system is the wrong way to go. Anything is easier than that, and it's a deceptively difficult thing to do right. ASP.NET Identity is actually pretty customizable, as it was created specifically for that purpose. You might need to do quite a bit to bootstrap your custom requirements fully, but it'll almost certainly be quicker and more secure using ASP.NET Identity.

UPDATE

UserManager's constructor takes an implementation of IUserStore. When working with Entity Framework, you typically just feed it Microsoft.AspNet.Identity.EntityFramework.UserStore, but this is your tie in point for extensibility. So, you can simply subclass UserStore and then override something like GetRolesAsync to do whatever custom role logic you need to implement. Then you'd just feed UserManager your subclass.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

'ASP.NET Identity 2.0 RoleManager.Roles'对象引用未设置为对象的实例。

来自分类Dev

在ASP.NET MVC 5中填充User.Identity

来自分类Dev

ASP.NET Identity - 扩展 User.Identity 的可用字段

来自分类Dev

为什么[Authorize(Roles =“ Admin”)]在带有ASP.NET Identity的MVC 5 RTM中无法使用?

来自分类Dev

ASP.NET Identity 2.0 Roles.IsUserInRole提供{“无效的对象名称'dbo.aspnet_SchemaVersions'。”}异常

来自分类Dev

使用ASP.NET MVC从Helpers调用User.Identity.GetUserId()

来自分类Dev

ASP.NET MVC User.Identity.GetUserId()返回错误的GUID

来自分类Dev

如何在Asp.Net MVC 4中模拟HttpContext.User.Identity.Name

来自分类Dev

How to create a user and get the newly created ID with ASP.NET Identity

来自分类Dev

ASP.NET MVC 5 how to delete a user and its related data in Identity 2.0

来自分类Dev

无法在ASP.NET中使用“ User.Identity.Name”获取Windows用户名

来自分类Dev

如何在Asp.Net MVC 4中模拟HttpContext.User.Identity.Name

来自分类Dev

ASP.NET MVC User.Identity.GetUserId()返回错误的GUID

来自分类Dev

无法在ASP.NET中使用“ User.Identity.Name”获取Windows用户名

来自分类Dev

使用ASP.NET Identity 2进行身份验证时,如何获得返回的User对象?

来自分类Dev

IdentitySever4 用户声明和 ASP.NET User.Identity

来自分类Dev

How does the "ASP.Net Identity" compare with "Windows Identity Foundation"?

来自分类Dev

“ ASP.Net Identity”与“ Windows Identity Foundation”相比如何?

来自分类Dev

在ASP.NET Identity中添加角色

来自分类Dev

ASP.Net Identity不创建用户

来自分类Dev

ASP.Net Identity 2 RemovePassword模拟

来自分类Dev

扩展ASP.NET Identity 2.0

来自分类Dev

ASP.Net Identity Force从SQL注销

来自分类Dev

Ninject和ASP.NET Identity 2.0

来自分类Dev

Asp.net Identity 2.0临时密码

来自分类Dev

使用ASP.NET Identity实施权利

来自分类Dev

被ASP.NET Identity和IdentityDbContext混淆

来自分类Dev

ASP.NET Identity用户创建

来自分类Dev

ASP.NET Identity缺少的字段

Related 相关文章

  1. 1

    'ASP.NET Identity 2.0 RoleManager.Roles'对象引用未设置为对象的实例。

  2. 2

    在ASP.NET MVC 5中填充User.Identity

  3. 3

    ASP.NET Identity - 扩展 User.Identity 的可用字段

  4. 4

    为什么[Authorize(Roles =“ Admin”)]在带有ASP.NET Identity的MVC 5 RTM中无法使用?

  5. 5

    ASP.NET Identity 2.0 Roles.IsUserInRole提供{“无效的对象名称'dbo.aspnet_SchemaVersions'。”}异常

  6. 6

    使用ASP.NET MVC从Helpers调用User.Identity.GetUserId()

  7. 7

    ASP.NET MVC User.Identity.GetUserId()返回错误的GUID

  8. 8

    如何在Asp.Net MVC 4中模拟HttpContext.User.Identity.Name

  9. 9

    How to create a user and get the newly created ID with ASP.NET Identity

  10. 10

    ASP.NET MVC 5 how to delete a user and its related data in Identity 2.0

  11. 11

    无法在ASP.NET中使用“ User.Identity.Name”获取Windows用户名

  12. 12

    如何在Asp.Net MVC 4中模拟HttpContext.User.Identity.Name

  13. 13

    ASP.NET MVC User.Identity.GetUserId()返回错误的GUID

  14. 14

    无法在ASP.NET中使用“ User.Identity.Name”获取Windows用户名

  15. 15

    使用ASP.NET Identity 2进行身份验证时,如何获得返回的User对象?

  16. 16

    IdentitySever4 用户声明和 ASP.NET User.Identity

  17. 17

    How does the "ASP.Net Identity" compare with "Windows Identity Foundation"?

  18. 18

    “ ASP.Net Identity”与“ Windows Identity Foundation”相比如何?

  19. 19

    在ASP.NET Identity中添加角色

  20. 20

    ASP.Net Identity不创建用户

  21. 21

    ASP.Net Identity 2 RemovePassword模拟

  22. 22

    扩展ASP.NET Identity 2.0

  23. 23

    ASP.Net Identity Force从SQL注销

  24. 24

    Ninject和ASP.NET Identity 2.0

  25. 25

    Asp.net Identity 2.0临时密码

  26. 26

    使用ASP.NET Identity实施权利

  27. 27

    被ASP.NET Identity和IdentityDbContext混淆

  28. 28

    ASP.NET Identity用户创建

  29. 29

    ASP.NET Identity缺少的字段

热门标签

归档