❔ Implementing security from a web library

We're coding a web library to generate a html CRUD at runtime from a metadata, after a lot of effort the project is getting cool, but now we need to implement security rules for the routes: Ex: in the DataDictionary area, where the metadata are configured only admin could access, and the MasterData Area would be access to the CRUD Form where logged users would access. What would be the best strategy to setup this scenario? Repo: https://github.com/JJConsulting/JJMasterData I've been implemented it by adding policy to the routes, but I thought it was too difficult to configure https://jjconsulting.tech/docs/JJMasterData/articles/authorization.html Any suggestion will be welcome. 😇
GitHub
GitHub - JJConsulting/JJMasterData: .NET CRUD library with Bootstra...
.NET CRUD library with Bootstrap support to create Forms at runtime from a data dictionary. - GitHub - JJConsulting/JJMasterData: .NET CRUD library with Bootstrap support to create Forms at runtime...
5 Replies
Anton
Anton2y ago
if (routeData.Values.ContainsKey("area"))
area = routeData.Values["area"]!.
if (routeData.Values.ContainsKey("area"))
area = routeData.Values["area"]!.
use TryGetValue
if ("MasterData".ToLower().Equals(area?.ToLower()))
{
if ("MasterData".ToLower().Equals(area?.ToLower()))
{
use string.Equals with StringComparison.InvariantCultureIgnoreCase, for example also, you've missed an else statement in the example else if ("DataDictionary" the policy thing seems optimal
Lucio Pelinson
Lucio PelinsonOP2y ago
tks @AntonC, but I'm still in doubt if deploying security along the route is a good idea, and if this is good practice.
Anton
Anton2y ago
I don't see why it would be bad
Lucio Pelinson
Lucio PelinsonOP2y ago
Ok. Thank you for your opinion. Let's keep going like this.
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server