Skip to content

Commit 1dfe8d5

Browse files
committed
- changed the help messages for target file and token input fields and added "Add btn" for saving the token into jenkins credential form
1 parent 51e5ad4 commit 1dfe8d5

File tree

6 files changed

+61
-10
lines changed

6 files changed

+61
-10
lines changed

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111

1212
<groupId>io.jenkins.plugins</groupId>
13-
<artifactId>.</artifactId>
13+
<artifactId>vigilnz-security</artifactId>
1414
<version>${revision}${changelist}</version>
1515
<packaging>hpi</packaging>
1616

@@ -59,6 +59,12 @@
5959
<version>${jenkins.version}</version>
6060
</dependency>
6161

62+
<dependency>
63+
<groupId>org.jenkins-ci.plugins</groupId>
64+
<artifactId>credentials</artifactId>
65+
<version>1337.v60b_d7b_c7b_c9f</version>
66+
</dependency>
67+
6268
</dependencies>
6369
</dependencyManagement>
6470

src/main/java/io/jenkins/plugins/SecurityCheckBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import hudson.util.FormValidation;
1010
import hudson.util.Secret;
1111
import org.kohsuke.stapler.DataBoundConstructor;
12+
import org.kohsuke.stapler.ForwardToView;
13+
import org.kohsuke.stapler.HttpResponse;
1214
import org.kohsuke.stapler.QueryParameter;
1315

1416
import java.io.IOException;
@@ -33,6 +35,11 @@ public String getTargetFile() {
3335
return targetFile;
3436
}
3537

38+
public HttpResponse doAddToken() {
39+
return new ForwardToView(this, "addToken.jelly");
40+
}
41+
42+
3643
// this function trigger when user click the build button
3744
@Override
3845
public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
2+
<f:section title="Add Vigilnz Token">
3+
<f:entry title="API Token">
4+
<f:textbox name="apiToken"/>
5+
</f:entry>
6+
7+
<f:entry title="Organization">
8+
<f:textbox name="org"/>
9+
</f:entry>
10+
11+
<f:entry title="Organization ID">
12+
<f:textbox name="orgId"/>
13+
</f:entry>
14+
15+
<f:submit value="Save Token"/>
16+
</f:section>
17+
</j:jelly>
Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
11
<?jelly escape-by-default='true'?>
22
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
33

4-
<f:entry title="Token" field="token">
5-
<f:password />
6-
</f:entry>
4+
<f:entry title="Token" field="token">
5+
<div style="display:flex;gap:8px;">
6+
<div style="flex:1 1 0;">
7+
<f:password/>
8+
</div>
9+
<!-- NORMAL BUTTON (does NOT submit the job form) -->
10+
<button type="button" class="jenkins-button" onclick="showTokenOptions()">
11+
+ Add
12+
</button>
13+
</div>
14+
</f:entry>
715

8-
<f:entry title="Target File" field="targetFile">
9-
<f:textbox />
10-
</f:entry>
16+
<!-- Hidden area -->
17+
<div id="tokenOptions" style="display:none; margin-top:10px;">
18+
<f:entry title="Organisation">
19+
<f:textbox name="organisation"/>
20+
</f:entry>
21+
</div>
22+
23+
<f:entry title="Target File" field="targetFile">
24+
<f:textbox/>
25+
</f:entry>
26+
27+
<script>
28+
function showTokenOptions() {
29+
document.getElementById("tokenOptions").style.display = "block";
30+
}
31+
</script>
1132

1233
</j:jelly>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div>
2-
This Target file is used to locate of the scan file of the project.
2+
This target file is used to locate the file that will be scanned for security vulnerabilities in the project.
33
</div>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<div>
2-
This token is used to authenticate with the external service.
3-
Please generate it from your dashboard and paste it here.
2+
This token is used to authenticate with the external Vigilnz Security service.
3+
Please generate it from your Vigilnz dashboard and paste it here.
44
</div>

0 commit comments

Comments
 (0)