Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to apply default AuthorizationPolicy even when Authorize attribute with Roles is specified #115

Open
marcominerva opened this issue Nov 18, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@marcominerva
Copy link
Owner

marcominerva commented Nov 18, 2022

In ASP.NET Core, if we use something like [Authorize(Roles = ... )] (or equivalent), then the requirements that have been associated with the default authorization policy aren't enforced, for example:

services.AddAuthorization(options =>
{
    var policyBuilder = new AuthorizationPolicyBuilder().RequireAuthenticatedUser();
    policyBuilder.Requirements.Add(new ValidSessionRequirement());
    options.DefaultPolicy = policyBuilder.Build();
});

It is necessary to provide a way to guarantee that requirements of default policy are verified even when we're using Roles within the Authorize attribute.

@marcominerva marcominerva added the enhancement New feature or request label Nov 18, 2022
@marcominerva marcominerva self-assigned this Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant