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

The policy name in the AuthorizeAttribute is not being passed to the GetPolicyAsync method of IAuthorizationPolicyProvider. #7704

Closed
wateryehxx opened this issue Nov 9, 2024 · 1 comment · Fixed by #7705
Assignees
Labels
Area: Authorization Issue is related to authorization 🌶️ hot chocolate

Comments

@wateryehxx
Copy link

wateryehxx commented Nov 9, 2024

Product

Hot Chocolate

Version

14.1.0

Link to minimal reproduction

https://github.com/ChilliCream/graphql-platform/blob/main/src/HotChocolate/Core/src/Authorization/AuthorizeAttribute.cs

Steps to reproduce

IAuthorizationPolicyProvider interface needs to implement three methods:

GetPolicyAsync
GetDefaultPolicyAsync
GetFallbackPolicyAsync

When using the AuthorizeAttribute in Chocolate and setting a Policy, then making requests through Postman, the policy is only passed to GetPolicyAsync during the first query. For subsequent queries, the policy is no longer passed to GetPolicyAsync.
This behavior is different from what occurs in Chocolate version 13, and the issue arises in Chocolate version 14.1.0.

What is expected?

Every time a query is made, the policy will be passed to GetPolicyAsync.

What is actually happening?

The policy is only passed to GetPolicyAsync during the first query. For subsequent queries, the policy is no longer passed to GetPolicyAsync.

Relevant log output

Additional context

No response

@tobias-tengler
Copy link
Collaborator

I'm sorry, this was introduced by a change I did in #7408. I've just corrected it in #7705.

I'll see to it getting back-ported to 14.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Authorization Issue is related to authorization 🌶️ hot chocolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants