Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Authorize policy attribute not compatible with dynamic policy provider #841

@jburbach

Description

@jburbach

I was attempting to implement something like the DynamicPolicyProvider in your unit tests where the idea is that you can specify the policy name at runtime and built it on the fly. While this passes your unit tests, if you try to actually declare something like [Authorize("MyPolicy")] on an action/controller you get an exception that states

InvalidOperationException: The AuthorizationPolicy named: 'MyPolicy' was not found.

Is this by design, and if so, what am I missing? I assume this happens because the policy isn't declared at runtime, but how is that compatible with the idea of building it at runtime?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions