如何在 ASP.NET 样板文件中实现行级安全性?
How to implement row level security in ASP.NET boilerplate?
我一个月前开始使用 ASP.NET Boilerplate,所以这是一个初学者级别的问题。我觉得这是一个很棒的框架 — 非常感谢您创建和分享它。
我正在开发一个多租户应用程序,现在我想根据租户筛选行。 ASP.NET 样板中正确的做法是什么?我正在考虑通过每个数据库调用传递 TenantId
或创建一个包含所有详细信息的请求上下文,并将其传递给方法调用。然后,在该方法中,检查该特定行的 TenantId
是否与我们传递的内容匹配。如果不是则丢弃,否则继续。在这里和那里进行一些调整,我可能会实现我想要的,但我想知道在 ASP.NET 样板中做这件事的正确方法是什么。
其次,在 ASP.NET 样板中集成 SQL 服务器的行级安全特性的开箱即用示例?
非常感谢。
I was developing a multi-tenant application and now I want to filter rows based on tenant. What is the correct way of doing it in ASP.NET Boilerplate? I was thinking of passing TenantId
with every DB call or creating a request context, which would have all details, and passing that along to the method call. And then, in the method, check if that particular row's TenantId
matches with what we are passing. If not then discard, else proceed.
这是 ASP.NET 样板的内置功能,通过 EF Core 的 Global Query Filters 实现。
更多信息:https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#data-filters
Second, any out-of-the-box example of integrating Row Level Security feature of SQL Server in ASP.NET Boilerplate?
不,所有数据库调用都是由连接字符串确定的同一可信数据库用户进行的。
你可能误会了Row-Level Security。
您可以根据应用程序用户传递不同的连接字符串,但这只是应用程序级授权 — 也是内置的,通过 Castle Windsor 的 Interceptors.
实现
更多信息:https://aspnetboilerplate.com/Pages/Documents/Authorization
我一个月前开始使用 ASP.NET Boilerplate,所以这是一个初学者级别的问题。我觉得这是一个很棒的框架 — 非常感谢您创建和分享它。
我正在开发一个多租户应用程序,现在我想根据租户筛选行。 ASP.NET 样板中正确的做法是什么?我正在考虑通过每个数据库调用传递 TenantId
或创建一个包含所有详细信息的请求上下文,并将其传递给方法调用。然后,在该方法中,检查该特定行的 TenantId
是否与我们传递的内容匹配。如果不是则丢弃,否则继续。在这里和那里进行一些调整,我可能会实现我想要的,但我想知道在 ASP.NET 样板中做这件事的正确方法是什么。
其次,在 ASP.NET 样板中集成 SQL 服务器的行级安全特性的开箱即用示例?
非常感谢。
I was developing a multi-tenant application and now I want to filter rows based on tenant. What is the correct way of doing it in ASP.NET Boilerplate? I was thinking of passing
TenantId
with every DB call or creating a request context, which would have all details, and passing that along to the method call. And then, in the method, check if that particular row'sTenantId
matches with what we are passing. If not then discard, else proceed.
这是 ASP.NET 样板的内置功能,通过 EF Core 的 Global Query Filters 实现。
更多信息:https://aspnetboilerplate.com/Pages/Documents/Multi-Tenancy#data-filters
Second, any out-of-the-box example of integrating Row Level Security feature of SQL Server in ASP.NET Boilerplate?
不,所有数据库调用都是由连接字符串确定的同一可信数据库用户进行的。
你可能误会了Row-Level Security。
您可以根据应用程序用户传递不同的连接字符串,但这只是应用程序级授权 — 也是内置的,通过 Castle Windsor 的 Interceptors.
实现更多信息:https://aspnetboilerplate.com/Pages/Documents/Authorization