-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
AuthorizationHandlerContext.Resource is not of type Endpoint with Endpoint Routing #13572
Comments
The linked issue isn't an authorization issue. What is calling into your handler? Are you doing it declaratively with the attribute or imperatively with code? |
Hi. We're closing this issue as we have heard no response from you for some time now. If you have more details and are encountering this issue please add a new reply and re-open the issue. |
Sorry, typo, I meant #11075, and didn't see the email notification :/
|
/cc @blowdart |
@HaoK is this expected for endpoint routing? |
As mentioned in the original post, using
|
So how do I write an AuthorizationHandler that has access to both the I'd like to do something like https://www.reddit.com/r/dotnet/comments/9vc6ym/custom_redirect_for_authorization_policy_failure/ to customize the route dictionary to go to particular pages. From what I can see, that doesn't seem to be possible? I need both |
If you're explicitly authorizing against a custom resource like var endpoint = // Get Endpoint off HttpContext (I don't remember off-hand exactly where it is)
var member = // your code to get the Models.Member object
authzService.AuthorizeAsync(...., new MyCustomResource(member, endpoint)); |
Thank you for contacting us. Due to a lack of activity on this discussion issue we're closing it in an effort to keep our backlog clean. If you believe there is a concern related to the ASP.NET Core framework, which hasn't been addressed yet, please file a new issue. This issue will be locked after 30 more days of inactivity. If you still wish to discuss this subject after then, please create a new issue! |
According to #11705,
AuthorizationHandlerContext.Resource
should be an instance ofEndpoint
in ASP.NET Core 3.0 when using endpoint routing, but it is instead an instance of my resource. Perhaps this is because I'm using theAuthorizationHandler<TRequirement, TResource>
version, but from documentation I've read, that seems to be the right thing to do, and indeed has worked correctly thus far. However, I now want to redirect to a different error page when authorization fails, but I cannot fetchEndpoint
as documented in linked issue.The text was updated successfully, but these errors were encountered: