Authorization Policies

Hello Radzen Team!

Regarding authorization policies, is there any way to implement them in a Radzen app?

Implementation would follow this example structure:

public class TestRequirement : IAuthorizationRequirement
{
    public int MinimumAge { get; }
    public TestRequirement(int minimumAge)
    {
        MinimumAge = minimumAge;
    }
}
services.AddAuthorization(options =>
{
    options.AddPolicy("TestPolicy", policy =>
        policy.Requirements.Add(new TestRequirement(18)));
});
@attribute [Authorize(Policy = "TestPolicy")]

Besides forcing the @attribute [Authorize] into pages, it could recognize existing policies and allow them inside the code at least. I definitely don't want to add the pages to the ignore list.

Another idea is to have a markup for ignored code, but I'm not sure if this is even feasible.

Hey @kim,

Not possible at the moment however we will add a TextBox in the page properties where you will be able to specify your custom policy:

2 Likes

That's great!

I think this will solve my problem.