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

Update example: @PreAuthorize and @Async don't play together out of the box #3979

Open
peholmst opened this issue Dec 4, 2024 · 0 comments
Assignees

Comments

@peholmst
Copy link
Member

peholmst commented Dec 4, 2024

Page: https://vaadin.com/docs/latest/building-apps/application-layer/background-jobs/triggers

There is an example that combines @PreAuthorize and @Async. However, this will not work out of the box since the security check is performed after the background thread has started to execute the job.

You need to use a DelegatingSecurityContextAsyncTaskExecutor for the security check to work. Note that any access denied exceptions are caught by the background thread and not the calling thread.

It may be easier to just use programmatic task execution when also dealing with security.

@peholmst peholmst self-assigned this Dec 4, 2024
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

No branches or pull requests

1 participant