-
Notifications
You must be signed in to change notification settings - Fork 168
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
fix: fix role checking when using websocket push (#20679) (CP: 24.6) #20709
Conversation
5591805
to
56f918e
Compare
// Workaround for https://github.com/vaadin/flow-components/issues/3646 | ||
// The issue causes the upload test to be flaky | ||
private void waitForUploads(UploadElement element, int maxSeconds) { | ||
WebDriver.Timeouts timeouts = getDriver().manage().timeouts(); | ||
timeouts.scriptTimeout(Duration.ofSeconds(maxSeconds)); | ||
|
||
String script = """ | ||
var callback = arguments[arguments.length - 1]; | ||
var upload = arguments[0]; | ||
let intervalId; | ||
intervalId = window.setInterval(function() { | ||
var inProgress = upload.files.filter(function(file) { return file.uploading;}).length >0; | ||
if (!inProgress) { | ||
window.clearInterval(intervalId); | ||
callback(); | ||
} | ||
}, 500); | ||
"""; | ||
getCommandExecutor().getDriver().executeAsyncScript(script, element); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this test change needed for the cherry pick or should it be its own pick for the upload test fix from #20642?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! You're right. I forgot to pick 20642. I'll add the labels, then I'll rebase this one (and the other related picks)
When using PUSH with websocket transport, the atmosphere wrapped request can be a no-op implementation whose isUserInRole method alwasy returns false, causing, for example, wrong access checking during navigation. This change falls back to Spring Securty for role checking when PUSH transport is websocket. It also fixes some tests in order to propagate the Spring Security context when starting Thread that perform UI operations. References psi#123 Part of #11026
56f918e
to
a3b4050
Compare
Quality Gate passedIssues Measures |
This ticket/PR has been released with Vaadin 24.6.0. |
When using PUSH with websocket transport, the atmosphere wrapped request can be a no-op implementation whose isUserInRole method alwasy returns false, causing, for example, wrong access checking during navigation. This change falls back to Spring Securty for role checking when PUSH transport is websocket.
It also fixes some tests in order to propagate the Spring Security context when starting Thread that perform UI operations.
References psi#123
Part of #11026