Skip to content

Commit da99ace

Browse files
committed
authhelper: add GUI to manage auth diags
Allow to manage the authentication diagnostics through the GUI. Signed-off-by: thc202 <thc202@gmail.com>
1 parent 8a7c26f commit da99ace

21 files changed

Lines changed: 1809 additions & 6 deletions

addOns/authhelper/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1111
- Add Authentication Report section for the log file.
1212
- Support for step delay in Browser Based Authentication, which replaces the auth tester "demo mode".
1313
- Support for min wait for time in Client Script Authentication.
14+
- Allow to manage the authentication diagnostics through the GUI.
1415

1516
## Changed
1617
- Now depends on minimum Common Library version 1.35.0 and Zest version 48.9.0.

addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/ExtensionAuthhelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import org.parosproxy.paros.network.HttpMessage;
5353
import org.parosproxy.paros.view.View;
5454
import org.zaproxy.addon.authhelper.internal.db.TableJdo;
55+
import org.zaproxy.addon.authhelper.internal.ui.diags.AuthDiagsPanel;
5556
import org.zaproxy.addon.commonlib.internal.TotpSupport;
5657
import org.zaproxy.addon.commonlib.internal.TotpSupport.TotpData;
5758
import org.zaproxy.addon.commonlib.internal.TotpSupport.TotpGenerator;
@@ -218,6 +219,8 @@ public void hook(ExtensionHook extensionHook) {
218219

219220
authDiagCollector = new AuthDiagnosticCollector();
220221
extensionHook.addHttpSenderListener(authDiagCollector);
222+
223+
new AuthDiagsPanel(extensionHook);
221224
}
222225
}
223226

addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/internal/db/Diagnostic.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.List;
2525
import javax.jdo.annotations.Cacheable;
2626
import javax.jdo.annotations.Column;
27+
import javax.jdo.annotations.Element;
2728
import javax.jdo.annotations.IdGeneratorStrategy;
2829
import javax.jdo.annotations.Order;
2930
import javax.jdo.annotations.PersistenceCapable;
@@ -53,6 +54,7 @@ public class Diagnostic {
5354
private String script;
5455

5556
@Order(column = "NUMBER")
57+
@Element(dependent = "true")
5658
@Persistent(mappedBy = "diagnostic")
5759
private List<DiagnosticStep> steps = new ArrayList<>();
5860

addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/internal/db/DiagnosticBrowserStorageItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public String getScript() {
6565
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
6666
private int id;
6767

68-
@Column(name = "STEPID")
68+
@Column(name = "STEPID", allowsNull = "false")
6969
private DiagnosticStep step;
7070

7171
@Column(jdbcType = "INTEGER")

addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/internal/db/DiagnosticMessage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class DiagnosticMessage {
4141
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
4242
private int id;
4343

44-
@Column(name = "STEPID")
44+
@Column(name = "STEPID", allowsNull = "false")
4545
private DiagnosticStep step;
4646

4747
private int messageId;

addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/internal/db/DiagnosticScreenshot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class DiagnosticScreenshot {
4141
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
4242
private int id;
4343

44-
@Column(name = "STEPID")
44+
@Column(name = "STEPID", allowsNull = "false")
4545
private DiagnosticStep step;
4646

4747
@Column(length = 8388608)

addOns/authhelper/src/main/java/org/zaproxy/addon/authhelper/internal/db/DiagnosticStep.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class DiagnosticStep {
4747
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
4848
private int id;
4949

50-
@Column(name = "DIAGNOSTICID")
50+
@Column(name = "DIAGNOSTICID", allowsNull = "false")
5151
private Diagnostic diagnostic;
5252

5353
@Column(length = 4096)
@@ -59,20 +59,22 @@ public class DiagnosticStep {
5959
@Column(name = "WEBELEMENTID")
6060
private DiagnosticWebElement webElement;
6161

62-
@Persistent(mappedBy = "step")
62+
@Persistent(mappedBy = "step", dependent = "true")
6363
private DiagnosticScreenshot screenshot;
6464

6565
@Order(column = "NUMBER")
66+
@Element(dependent = "true")
6667
@Persistent(mappedBy = "step")
6768
private List<DiagnosticMessage> messages = new ArrayList<>();
6869

6970
@Persistent(table = "AUTHHELPER_DIAGNOSTIC_STEP_WEB_ELEMENTS")
7071
@Join(column = "STEPID")
71-
@Element(column = "WEBELEMENTID")
72+
@Element(column = "WEBELEMENTID", dependent = "true")
7273
@Order(column = "NUMBER")
7374
private List<DiagnosticWebElement> webElements = new ArrayList<>();
7475

7576
@Order(column = "NUMBER")
77+
@Element(dependent = "true")
7678
@Persistent(mappedBy = "step")
7779
private List<DiagnosticBrowserStorageItem> browserStorageItems = new ArrayList<>();
7880

0 commit comments

Comments
 (0)