aboutsummaryrefslogtreecommitdiffstats
path: root/netx/net/sourceforge/jnlp/security
diff options
context:
space:
mode:
authorSaad Mohammad <[email protected]>2011-08-22 15:09:47 -0400
committerSaad Mohammad <[email protected]>2011-08-22 15:09:47 -0400
commitca57a77f66bbca5e2be1da83868ba0b5daab0ca3 (patch)
tree69fae35674d0d6c7059b2eea12685a3fffcb89a2 /netx/net/sourceforge/jnlp/security
parent3fdbc63fe69b247c9aaa49a322142a2085248095 (diff)
Checks and verifies a signed JNLP file at the launch of the application. A signed JNLP warning is displayed if appropriate.
Diffstat (limited to 'netx/net/sourceforge/jnlp/security')
-rw-r--r--netx/net/sourceforge/jnlp/security/MoreInfoPane.java13
-rw-r--r--netx/net/sourceforge/jnlp/security/SecurityDialog.java14
2 files changed, 26 insertions, 1 deletions
diff --git a/netx/net/sourceforge/jnlp/security/MoreInfoPane.java b/netx/net/sourceforge/jnlp/security/MoreInfoPane.java
index b6a27d1..a46f3ff 100644
--- a/netx/net/sourceforge/jnlp/security/MoreInfoPane.java
+++ b/netx/net/sourceforge/jnlp/security/MoreInfoPane.java
@@ -61,8 +61,11 @@ import javax.swing.SwingConstants;
*/
public class MoreInfoPane extends SecurityDialogPanel {
+ private boolean showSignedJNLPWarning;
+
public MoreInfoPane(SecurityDialog x, CertVerifier certVerifier) {
super(x, certVerifier);
+ showSignedJNLPWarning= x.requiresSignedJNLPWarning();
addComponents();
}
@@ -72,6 +75,11 @@ public class MoreInfoPane extends SecurityDialogPanel {
private void addComponents() {
ArrayList<String> details = certVerifier.getDetails();
+ // Show signed JNLP warning if the signed main jar does not have a
+ // signed JNLP file and the launching JNLP file contains special properties
+ if(showSignedJNLPWarning)
+ details.add(R("SJNLPFileIsNotSigned"));
+
int numLabels = details.size();
JPanel errorPanel = new JPanel(new GridLayout(numLabels, 1));
errorPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@@ -88,6 +96,11 @@ public class MoreInfoPane extends SecurityDialogPanel {
errorPanel.add(new JLabel(htmlWrap(details.get(i)), icon, SwingConstants.LEFT));
}
+
+ // Removes signed JNLP warning after it has been used. This will avoid
+ // any alteration to certVerifier.
+ if(showSignedJNLPWarning)
+ details.remove(details.size()-1);
JPanel buttonsPanel = new JPanel(new BorderLayout());
JButton certDetails = new JButton(R("SCertificateDetails"));
diff --git a/netx/net/sourceforge/jnlp/security/SecurityDialog.java b/netx/net/sourceforge/jnlp/security/SecurityDialog.java
index 1988e5e..8ffbdd4 100644
--- a/netx/net/sourceforge/jnlp/security/SecurityDialog.java
+++ b/netx/net/sourceforge/jnlp/security/SecurityDialog.java
@@ -92,6 +92,9 @@ public class SecurityDialog extends JDialog {
*/
private Object value;
+ /** Should show signed JNLP file warning */
+ private boolean requiresSignedJNLPWarning;
+
SecurityDialog(DialogType dialogType, AccessType accessType,
JNLPFile file, CertVerifier jarSigner, X509Certificate cert, Object[] extras) {
super();
@@ -103,6 +106,9 @@ public class SecurityDialog extends JDialog {
this.extras = extras;
initialized = true;
+ if(file != null)
+ requiresSignedJNLPWarning= file.requiresSignedJNLPWarning();
+
initDialog();
}
@@ -164,8 +170,9 @@ public class SecurityDialog extends JDialog {
public static void showMoreInfoDialog(
CertVerifier jarSigner, SecurityDialog parent) {
+ JNLPFile file= parent.getFile();
SecurityDialog dialog =
- new SecurityDialog(DialogType.MORE_INFO, null, null,
+ new SecurityDialog(DialogType.MORE_INFO, null, file,
jarSigner);
dialog.setModalityType(ModalityType.APPLICATION_MODAL);
dialog.setVisible(true);
@@ -372,5 +379,10 @@ public class SecurityDialog extends JDialog {
public void addActionListener(ActionListener listener) {
listeners.add(listener);
}
+
+ public boolean requiresSignedJNLPWarning()
+ {
+ return requiresSignedJNLPWarning;
+ }
}