Skip to content

Allow throwing an access denied exception on denormalization of secured properties #7221

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dwgebler
Copy link
Contributor

Throw AccessDeniedException when security conditions for an operation or property aren't met on denormalize

Q A
Branch? main
Tickets Closes #7198
License MIT
Doc PR api-platform/docs#2170

Supports adding throw_on_access_denied (bool) as a value in extra_properties on an Operation or ApiProperty so that during denormalization, if any security condition is not met an AccessDeniedException is thrown instead of silently reverting the property to its previous value.

throw AccessDeniedException when security conditions for an operation or
property aren't met on denormalize
@dwgebler
Copy link
Contributor Author

Not sure what the reason is for failure:

PHPUnit\Framework\Exception: Class "ApiPlatform\Symfony\Security\Exception\AccessDeniedException" does not exist

Relevant tests pass locally and this class does exist in branch and main? https://github.com/api-platform/core/blob/main/src/Symfony/Security/Exception/AccessDeniedException.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow config option to throw 403 when securityPostDenormalize fails for an API property
1 participant