简体   繁体   English

将asp.net标识与地理授权一起使用

[英]Use asp.net identity with geography authorize

I used Asp.net Identity in an enterprise web application (mvc) with role and group based permissions management. 我在企业Web应用程序(mvc)中使用Asp.net Identity,具有基于角色和组的权限管理。 Now I have to add a new entity as geography to divided users in different provinces or regions to authorized users access. 现在我必须添加一个新实体作为地理位置,以便将不同省份或地区的用户划分给授权用户访问。 I mean every user can fetch his/her province or region data in pages. 我的意思是每个用户都可以在页面中获取他/她的省或地区数据。 Is there a best practice for this purpose? 为此目的是否有最佳实践? Or can any one guide me about this subject? 或者任何人都可以指导我这个主题吗?

thanks. 谢谢。

Update: I have a simple design in my mind like this .(I could not attached the image here.) 更新:我在我的脑海里是一个简单的设计, (我无法连接下面的图片)。

The way that users are distinct to regions is base on their IP address. 用户与区域不同的方式取决于其IP地址。 So you read their IP and then base on this IP you attach him with a country/region. 所以,你阅读他们的知识产权,然后根据这个知识产权,你附上一个国家/地区。

Now there are some free and commercial databases that gives you this connection Ip with region and here is how to do it from some other answer: 现在有一些免费和商业数据库为您提供了这个与区域的连接,以及如何从其他答案中做到这一点:

geolocating an IP address 地理定位IP地址

If i had to implement this i would add categories to users and regional data: Example: 如果我必须实现这一点,我会向用户和区域数据添加类别:示例:

  • user Peter Smith, Category: NorthGermany 用户Peter Smith,分类:NorthGermany
  • user Susan Brown, Category: NorthGermany,SouthGermany 用户Susan Brown,分类:NorthGermany,SouthGermany
  • regional data: Store Hamburg, Category NorthGermany 区域数据:Store Hamburg,NorthGermany
  • regional data: Store Munich, Category SouthGermany 区域数据:慕尼黑商店,SouthGermany类别

The user is only allowed to see those regional data where he or she has categories for. 用户只能看到他或她有类别的区域数据。

Peter can see the hamburg store while susan can see hamburg and munich 彼得可以看到汉堡商店,而苏珊可以看到汉堡和慕尼黑

I've developed a claims based security framework for covering all my needs in security layer as user, group and claim manager with row level security also. 我已经开发了一个基于声明的安全框架,用于满足我在安全层中作为用户,组和声明管理器的所有需求,同时还具有行级安全性。 I could cover geo authorize with rls concept in my project. 我可以在我的项目中用rls概念覆盖地理授权。 You can find it in GitHub to check the source and use it. 您可以在GitHub中找到它来检查源并使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用新的ASP.NET Identity 2.0角色和授权属性? - How to use new ASP.NET Identity 2.0 Roles and Authorize Attribute? Authorize和GetRoles在ASP.NET Identity中不起作用 - Authorize and GetRoles doesn't work in ASP.NET Identity 授权属性始终返回错误的ASP.net MVC标识 - Authorize Attribute always returning false ASP.net MVC Identity ASP.NET Core 标识 [Authorize(Roles ="ADMIN")] 不起作用 - ASP.NET Core Identity [Authorize(Roles ="ADMIN")] not work 使用来自外部提供程序的ASP.NET Identity和JWT身份验证时,可以使用“角色和声明”的Authorize属性筛选吗? - Can I use the Authorize attribute filtering by Roles and Claims when using ASP.NET Identity and JWT authentication from external providers? 如何在ASP.Net Identity中使用ActiveDirectoryMembershipProvider? - How to use ActiveDirectoryMembershipProvider with ASP.Net Identity? 授权 asp.net 中的角色 - authorize roles in asp.net 配置 Identity Server 以使用 ASP.NET Identity 角色 - Configuring Identity Server to use ASP.NET Identity roles 授权不适用于使用 ASP.NET Core 3.1 Identity 和 MongoDB 的角色 - Authorize not working for roles using ASP.NET Core 3.1 Identity with MongoDB ASP.NET MVC上的Windows Identity Framework-如何基于操作授权用户? - Windows Identity Framework on ASP.NET MVC - how to authorize user per action basis?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM