I have a Java application running on the web through a Webswing server. A Webswing server translates Java to HTML5 for secure web usage.
I use netscape.javascript.JSObject to store and read cookies from the Java application.
// write
String cookie = "name=userstuff; Expires.... ";
JSObject global = JSObject.getWindow(null);
global.eval("document.cookie=" + "\"" + cookie + "\"");
//read
Object cookies= global.eval("document.cookie");
I have not found a way to store passwords in the browser password section. In Chrome the section is:
chrome://settings/passwords
Could you tell me if the mechanisms to store passwords in the passwords section is the same as the one for cookies.
Please refer to this documentation of Credential Management API - https://whatwebcando.today/credentials.html
Using the API you can programmatically force a save password dialog to show to user, who can decide whether to save the password. The API is currently supported only in Chrome.
Basically this API has nothing to do with Webswing, anyway you should be able to use the Credential Management API same way you use netscape.javascript.JSObject
to work with cookies. Try this, it worked for me with Webswing:
global.eval("navigator.credentials.store(new PasswordCredential({id: 'username@email.com', password: 'password', name: 'User Name'}));");