/hg/icedtea-web: Basic certificate got command line saving support
jvanek at icedtea.classpath.org
jvanek at icedtea.classpath.org
Fri Jan 13 15:11:57 UTC 2017
changeset 8de03d88f768 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=8de03d88f768
author: Jiri Vanek <jvanek at redhat.com>
date: Fri Jan 13 16:18:49 2017 +0100
Basic certificate got command line saving support
* netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java: if dialog is CertWarningPane and should be remembered, is.
* netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java: extracted saving method, so it can be reused
diffstat:
ChangeLog | 8 ++
netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java | 7 ++
netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java | 34 +++++----
3 files changed, 34 insertions(+), 15 deletions(-)
diffs (84 lines):
diff -r 9a59ac4283f2 -r 8de03d88f768 ChangeLog
--- a/ChangeLog Wed Jan 11 16:20:21 2017 +0100
+++ b/ChangeLog Fri Jan 13 16:18:49 2017 +0100
@@ -1,3 +1,11 @@
+2017-01-13 Jiri Vanek <jvanek at redhat.com>
+
+ Basic certificate got command line saving support
+ * netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java: if
+ dialog is CertWarningPane and should be remembered, is.
+ * netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java: extracted
+ saving method, so it can be reused
+
2017-01-11 Jiri Vanek <jvanek at redhat.com>
* icedteaweb-completion.in: improved to suggest also files in relevant cases
diff -r 9a59ac4283f2 -r 8de03d88f768 netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java
--- a/netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java Wed Jan 11 16:20:21 2017 +0100
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialogMessageHandler.java Fri Jan 13 16:18:49 2017 +0100
@@ -50,6 +50,7 @@
import net.sourceforge.jnlp.runtime.Translator;
import net.sourceforge.jnlp.security.appletextendedsecurity.UnsignedAppletTrustConfirmation;
import net.sourceforge.jnlp.security.dialogresults.BasicDialogValue;
+import net.sourceforge.jnlp.security.dialogs.CertWarningPane;
import net.sourceforge.jnlp.security.dialogs.remember.RememberDialog;
import net.sourceforge.jnlp.security.dialogs.remember.RememberableDialog;
import net.sourceforge.jnlp.security.dialogs.remember.SavedRememberAction;
@@ -208,6 +209,12 @@
if (message.userResponse != null) {
value = message.userResponse.writeValue();
}
+ if (dialog.getSecurityDialogPanel() instanceof CertWarningPane) {
+ CertWarningPane cp = (CertWarningPane) (dialog.getSecurityDialogPanel());
+ if (remember) {
+ cp.saveCert();
+ }
+ }
RememberDialog.getInstance().setOrUpdateRememberedState(dialog, codebase, new SavedRememberAction(RememberDialog.createAction(remember, message.userResponse), value));
} catch (Exception ex) {
OutputController.getLogger().log(OutputController.Level.ERROR_DEBUG, ex);
diff -r 9a59ac4283f2 -r 8de03d88f768 netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java
--- a/netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java Wed Jan 11 16:20:21 2017 +0100
+++ b/netx/net/sourceforge/jnlp/security/dialogs/CertWarningPane.java Fri Jan 13 16:18:49 2017 +0100
@@ -336,22 +336,26 @@
@Override
public void actionPerformed(ActionEvent e) {
if (alwaysTrust != null && alwaysTrust.isSelected()) {
- try {
- KeyStore ks = KeyStores.getKeyStore(Level.USER, Type.CERTS);
- X509Certificate c = (X509Certificate) parent.getCertVerifier().getPublisher(null);
- CertificateUtils.addToKeyStore(c, ks);
- File keyStoreFile = KeyStores.getKeyStoreLocation(Level.USER, Type.CERTS).getFile();
- if (!keyStoreFile.isFile()) {
- FileUtils.createRestrictedFile(keyStoreFile, true);
- }
- SecurityUtil.storeKeyStore(ks, keyStoreFile);
- OutputController.getLogger().log("certificate is now permanently trusted");
- } catch (Exception ex) {
+ saveCert();
+ }
+ }
+ }
+
+ public void saveCert() {
+ try {
+ KeyStore ks = KeyStores.getKeyStore(Level.USER, Type.CERTS);
+ X509Certificate c = (X509Certificate) parent.getCertVerifier().getPublisher(null);
+ CertificateUtils.addToKeyStore(c, ks);
+ File keyStoreFile = KeyStores.getKeyStoreLocation(Level.USER, Type.CERTS).getFile();
+ if (!keyStoreFile.isFile()) {
+ FileUtils.createRestrictedFile(keyStoreFile, true);
+ }
+ SecurityUtil.storeKeyStore(ks, keyStoreFile);
+ OutputController.getLogger().log("certificate is now permanently trusted");
+ } catch (Exception ex) {
// TODO: Let NetX show a dialog here notifying user
- // about being unable to add cert to keystore
- OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ex);
- }
- }
+ // about being unable to add cert to keystore
+ OutputController.getLogger().log(OutputController.Level.ERROR_ALL, ex);
}
}
More information about the distro-pkg-dev
mailing list