# Authorization Policies

**URL:** <https://forum.radzen.com/t/authorization-policies/5683>\
**Category:** Blazor Server\
**Created:** [November 18, 2020, 8:14pm UTC](https://forum.radzen.com/t/authorization-policies/5683 "2020-11-18T20:14:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [November 18, 2020, 8:14pm UTC](https://forum.radzen.com/t/authorization-policies/5683/1 "2020-11-18T20:14:58Z")

</div>

Hello Radzen Team!

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

Implementation would follow this example structure:

```auto
public class TestRequirement : IAuthorizationRequirement
{
    public int MinimumAge { get; }
    public TestRequirement(int minimumAge)
    {
        MinimumAge = minimumAge;
    }
}
```

```auto
services.AddAuthorization(options =>
{
    options.AddPolicy("TestPolicy", policy =>
        policy.Requirements.Add(new TestRequirement(18)));
});
```

```auto
@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.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [November 19, 2020, 10:06am UTC](https://forum.radzen.com/t/authorization-policies/5683/2 "2020-11-19T10:06:29Z")

</div>

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:

 ![image](https://forum.radzen.com/uploads/default/original/2X/f/f09e6d085dd5c4f705f27bfbfc8b320138f2d645.png)

---

<div class="post-metadata">

**Author:** ![kim](https://forum.radzen.com/user_avatar/forum.radzen.com/kim/32/9988_2.png) [@kim](https://forum.radzen.com/u/kim)\
**Post date:** [November 19, 2020, 11:00am UTC](https://forum.radzen.com/t/authorization-policies/5683/3 "2020-11-19T11:00:45Z")

</div>

That's great!

I think this will solve my problem.

---

<div class="post-metadata">

**Author:** ![Eric\_vU](https://forum.radzen.com/letter_avatar_proxy/v4/letter/e/b5e925/32.png) [@Eric\_vU](https://forum.radzen.com/u/Eric_vU)\
**Post date:** [September 3, 2021, 1:50pm UTC](https://forum.radzen.com/t/authorization-policies/5683/4 "2021-09-03T13:50:28Z")

</div>

Do you have an example? I want to do the same but am not sure how to implement it.

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [September 3, 2021, 1:53pm UTC](https://forum.radzen.com/t/authorization-policies/5683/5 "2021-09-03T13:53:26Z")

</div>

> <https://stackoverflow.com/questions/41992845/loading-asp-net-core-authorization-policy-from-database>
