Skip to content

Commit c792f6a

Browse files
author
thort
committed
Improve Signature Help Window
1 parent f5b7145 commit c792f6a

File tree

2 files changed

+35
-79
lines changed

2 files changed

+35
-79
lines changed

src/main/java/application/SamlTabController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,8 @@ public void setGUIEditable(boolean editable) {
594594
}
595595

596596
public void showSignatureHelp() {
597-
SignatureHelpWindow window = new SignatureHelpWindow();
597+
var window = new SignatureHelpWindow();
598+
window.setLocationRelativeTo(BurpExtender.api.userInterface().swingUtils().suiteFrame());
598599
window.setVisible(true);
599600
}
600601

Lines changed: 33 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,40 @@
11
package gui;
22

3-
import java.awt.Dimension;
4-
import java.awt.Font;
5-
import java.awt.GridBagConstraints;
6-
import java.awt.GridBagLayout;
7-
import java.awt.Insets;
8-
9-
import javax.swing.JFrame;
10-
import javax.swing.JLabel;
11-
import javax.swing.JPanel;
12-
import javax.swing.border.EmptyBorder;
3+
import javax.swing.*;
4+
import java.awt.*;
5+
import java.io.Serial;
136

147
public class SignatureHelpWindow extends JFrame {
158

16-
17-
private static final long serialVersionUID = 1L;
18-
private JPanel contentPane;
19-
20-
public SignatureHelpWindow() {
21-
setTitle("SAML Signature Help");
22-
setMinimumSize(new Dimension(496, 415));
23-
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
24-
setBounds(100, 100, 496, 415);
25-
contentPane = new JPanel();
26-
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
27-
setContentPane(contentPane);
28-
GridBagLayout gbl_contentPane = new GridBagLayout();
29-
gbl_contentPane.columnWidths = new int[] { 224, 0, 0 };
30-
gbl_contentPane.rowHeights = new int[] { 0, 0, 62, 0, 0, 0, 0 };
31-
gbl_contentPane.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
32-
gbl_contentPane.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
33-
contentPane.setLayout(gbl_contentPane);
34-
35-
JLabel lblSamlSignaturesHelp = new JLabel("SAML Signatures Help");
36-
lblSamlSignaturesHelp.setFont(new Font("Tahoma", Font.PLAIN, 14));
37-
GridBagConstraints gbc_lblSamlSignaturesHelp = new GridBagConstraints();
38-
gbc_lblSamlSignaturesHelp.anchor = GridBagConstraints.WEST;
39-
gbc_lblSamlSignaturesHelp.insets = new Insets(0, 0, 5, 5);
40-
gbc_lblSamlSignaturesHelp.gridx = 0;
41-
gbc_lblSamlSignaturesHelp.gridy = 0;
42-
contentPane.add(lblSamlSignaturesHelp, gbc_lblSamlSignaturesHelp);
43-
44-
JLabel lblNewLabel = new JLabel("Certificate Combo Box");
45-
GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
46-
gbc_lblNewLabel.anchor = GridBagConstraints.NORTHWEST;
47-
gbc_lblNewLabel.insets = new Insets(0, 0, 5, 5);
48-
gbc_lblNewLabel.gridx = 0;
49-
gbc_lblNewLabel.gridy = 2;
50-
contentPane.add(lblNewLabel, gbc_lblNewLabel);
51-
52-
JLabel lblChooseACertificate = new JLabel(
53-
"<html>Choose a certificate of this list to sign the message or the assertion. You can "
54-
+ "manage the SAML Certificates in the SAML Certificates Tab.</html>");
55-
lblChooseACertificate.putClientProperty("html.disable", null);
56-
GridBagConstraints gbc_lblChooseACertificate = new GridBagConstraints();
57-
gbc_lblChooseACertificate.anchor = GridBagConstraints.NORTH;
58-
gbc_lblChooseACertificate.fill = GridBagConstraints.HORIZONTAL;
59-
gbc_lblChooseACertificate.insets = new Insets(0, 0, 5, 0);
60-
gbc_lblChooseACertificate.gridx = 1;
61-
gbc_lblChooseACertificate.gridy = 2;
62-
contentPane.add(lblChooseACertificate, gbc_lblChooseACertificate);
63-
64-
JLabel lblResignMessage = new JLabel("Resign Message / Assertion");
65-
GridBagConstraints gbc_lblResignMessage = new GridBagConstraints();
66-
gbc_lblResignMessage.anchor = GridBagConstraints.NORTHWEST;
67-
gbc_lblResignMessage.insets = new Insets(0, 0, 5, 5);
68-
gbc_lblResignMessage.gridx = 0;
69-
gbc_lblResignMessage.gridy = 4;
70-
contentPane.add(lblResignMessage, gbc_lblResignMessage);
71-
72-
JLabel lblWithTheChosen = new JLabel(
73-
"<html> With the chosen certificate the message or "
74-
+ "the assertion is signed. If the message or assertion was signed, the signature is replaced. <br/> "
75-
+ "If you choose to sign the assertion, the message signature is removed, because the signature gets invalid.</html>");
76-
lblWithTheChosen.putClientProperty("html.disable", null);
77-
GridBagConstraints gbc_lblWithTheChosen = new GridBagConstraints();
78-
gbc_lblWithTheChosen.fill = GridBagConstraints.HORIZONTAL;
79-
gbc_lblWithTheChosen.insets = new Insets(0, 0, 5, 0);
80-
gbc_lblWithTheChosen.gridx = 1;
81-
gbc_lblWithTheChosen.gridy = 4;
82-
contentPane.add(lblWithTheChosen, gbc_lblWithTheChosen);
83-
}
9+
@Serial
10+
private static final long serialVersionUID = 1L;
11+
12+
13+
public SignatureHelpWindow() {
14+
var text = """
15+
<h1>SAML Signature Help</h1>
16+
<h2>Certificate Combo Box</h2>
17+
Choose a certificate of this list to sign the message or the assertion. You can manage the SAML
18+
Certificates in the SAML Certificates Tab.
19+
<h2>Resign Message / Assertion</h2>
20+
With the chosen certificate the message or the assertion is signed. If the message or assertion
21+
was signed, the signature is replaced.<br/>
22+
If you choose to sign the assertion, the message signature is removed, because the signature
23+
gets invalid.
24+
""";
25+
26+
var textPane = new JTextPane();
27+
textPane.setContentType("text/html");
28+
textPane.setEditable(false);
29+
textPane.setCaret(null);
30+
textPane.setText(text);
31+
32+
var scrollPane = new JScrollPane(textPane);
33+
34+
setTitle("SAML Signature Help");
35+
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
36+
setSize(400, 600);
37+
setContentPane(scrollPane);
38+
}
8439

8540
}

0 commit comments

Comments
 (0)