RAP 3.23 Clipboard.js inside org.eclipse.rap.rwt does not support embedded credentials inside the URL
Let's make sure issue is not already fixed in latest builds first.
- [x] I verified I can reproduce this issue against latest Integration Build of Eclipse SDK
Steps to reproduce
From a fresh installation and clean workspace:
I tried
- The basic authentication with username and password embedded in the URL, for eg. http://admin:admin@localhost:8085/
- It does not work, the error which we get is Application terminated unexpectedly
- While Inspect we found that the error it throws is : TypeError: Failed to execute 'fetch' on 'Window': Request cannot be constructed from a URL that includes credentials:
- I think it is due to Clipboard.js that has been added as part of rap-client.js file, which is causing these issue. It works fine when we don't provide any username and password in the URL, the pop-ups appears and we enter credentials
- Clipboard.js is part of org.eclipse.rap.rwt.jar : org.eclipse.rap.rwt/js/rwt/client/Clipboard.js
- But, there is hard requirement for these, so we need to pass username and password in the URL itself.
I expected: < To work as it is with username and password in the URL >
But got: < Application Terminated Unexpectedly >
Tested under this environment:
- OS & version: Windows 10
- Eclipse IDE/Platform version (as shown in Help > About): Eclipse 2022-12
- RAP version is 3.23
- Java version is 11
- Tomcat version is 9.0.86
Community
- [x] I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.
I believe that for security reasons such requests are blocked by the browser. It's not related to Clipboard.js at all. You have to use "Authorization" header instead
But, once I remove the Clipbord.js file from rap-client.js entry then it works fine. I still think it is something to do with that,
Clipboard.js [1] is a static file with two static functions writeText and readText. If you don't use clipboard support from the server-side, these functions are not invoked at all.
[1] https://github.com/eclipse-rap/org.eclipse.rap/blob/main/bundles/org.eclipse.rap.rwt/js/rwt/client/Clipboard.js