Skip to content

Commit 67ebadf

Browse files
author
Anders Breid
authored
New field in Authentication (#220)
- Add field BASIC_AUTH _Jenkins CSRF Protection (crumb) will be BASIC_AUTH_CRUMB in a subscription - Add help popup for authentication - Update in documentation and help, and AUTH type name.
1 parent ad9a30f commit 67ebadf

File tree

11 files changed

+39
-20
lines changed

11 files changed

+39
-20
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
<dependency>
176176
<groupId>com.github.eiffel-community</groupId>
177177
<artifactId>eiffel-commons</artifactId>
178-
<version>0.0.9</version>
178+
<version>0.0.12</version>
179179
</dependency>
180180
</dependencies>
181181

src/main/java/com/ericsson/ei/frontend/WebController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import org.springframework.web.bind.annotation.RequestMapping;
2525

2626
import com.ericsson.ei.frontend.utils.WebControllerUtils;
27-
import com.ericsson.eiffelcommons.utils.RegExProvider;
27+
import com.ericsson.eiffelcommons.helpers.RegExProvider;
2828

2929
@Controller
3030
public class WebController {

src/main/resources/static/js/subscription.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
// Global vars
22
var save_method;
33
var defaultFormKeyValuePair = { "formkey": "", "formvalue": "" };
4-
var defaultFormKeyValuePairAuth = { "formkey": "Authorization", "formvalue": "" };
54

65
jQuery(document).ready(function () {
76

87
$('.modal-dialog').draggable({ handle: ".modal-header", cursor: 'move' });
9-
8+
109
checkBackendStatus();
1110

1211
function loadSubButtons() {
@@ -175,7 +174,8 @@ jQuery(document).ready(function () {
175174
]);
176175
self.authenticationType_in = ko.observableArray([
177176
{ "text": "NO_AUTH", value: "NO_AUTH" },
178-
{ "text": "BASIC_AUTH", value: "BASIC_AUTH" }
177+
{ "text": "BASIC_AUTH", value: "BASIC_AUTH" },
178+
{ "text": "BASIC_AUTH Jenkins CSRF Protection (crumb)", value: "BASIC_AUTH_JENKINS_CSRF" }
179179
]);
180180
self.repeat_in = ko.observableArray([
181181
{ "value": true, "label": "Activate Repeat" }
@@ -746,7 +746,7 @@ jQuery(document).ready(function () {
746746
$('#invalidSubscriptionName').text("SubscriptionName must not be empty");
747747
$('#subscriptionNameInput').addClass("is-invalid");
748748
error = true;
749-
}
749+
}
750750
// This regular expression is fetched from the Eiffel-Commons. It is same for both front-end and back-end
751751
var regExpressionFlag = "g";
752752
var regExpression = new RegExp(getSubscriptionNameRegex(), regExpressionFlag);

src/main/resources/templates/subscription.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,14 +261,22 @@ <h3 class="modal-title text-center" id="formHeader">Subscription Form</h3>
261261

262262
<!-- AUTHENTICATION -->
263263
<div class="pt-3 form-group">
264-
<label class="h5 pl-1 control-label font-weight-bold">Authorization</label>
264+
<label class="h5 pl-1 control-label font-weight-bold">Authentication</label>
265+
<img class="cursor-pointer" id="authInfo" alt="Auth Info"
266+
src="assets/images/information.png" data-toggle="tooltip" data-placement="top"
267+
title="This selector enables you to select different authentication methods. <br>
268+
NO_AUTH: No Authentication used<br>
269+
BASIC_AUTH: Username and password will be Base 64 encoded<br>
270+
BASIC_AUTH Jenkins CSRF Protection (crumb): Username and password will be Base 64 encoded.
271+
A crumb will be fetched automatically before request is made. (Currently default in many Jenkins instances)
272+
Will work even when CSRF is disabled in Jenkins" />
265273
<div>
266274
<select id="selectAuth" title="Choose an authentication type" data-bind="options: $root.authenticationType_in,
267275
optionsText: 'text', optionsValue: 'value', value: authenticationType">
268276
</select>
269277
</div>
270278
</div>
271-
<div class="p-1 border form-group" data-bind="visible: authenticationType() == 'BASIC_AUTH'">
279+
<div class="p-1 border form-group" data-bind="visible: authenticationType() != 'NO_AUTH'">
272280
<label class="pt-1 control-label font-weight-bold">Username</label>
273281
<div>
274282
<input id="userNameInput" title="Enter user name" data-bind="textInput:userName"

wiki/markdown/add-subscription.md

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This form is used to add subscription through front-end GUI. Here is a
44
description of the elements available on this form.
55

6-
<img src="images/subscription_add_form1.png">
6+
<img border="1" src="images/subscription_add_part1.png">
77
</img>
88

99
**Load Subscription Template:** In this dropdown list, options are given to
@@ -14,6 +14,9 @@ Mail Trigger.
1414
**SubscriptionName:** A field to give a name to the current subscription. Only
1515
letters, underscore and numbers are allowed in this field.
1616

17+
<img border="1" src="images/subscription_add_part2.png">
18+
</img>
19+
1720
**NotificationType:** There are two options: REST POST and
1821
Mail Trigger, depending on how a subscriber want to be notified when a
1922
subscription is fulfilled. If Notification type MAIL is selected an email
@@ -37,23 +40,31 @@ Parameters such as a Jenkins job-token can be included in this field.
3740
**Note**: The job-token should not be mistaken for the API token that is
3841
used as a password for authentication against the entire jenkins instance.
3942

40-
<img src="images/subscription_add_form2.png">
43+
<img border="1" src="images/subscription_add_part3.png">
4144
</img>
4245

43-
**Authorization:** A list to select authorization type. Currently, only one
44-
authorization type is supported, which is “BASIC_AUTH”. The option “NO_AUTH”
45-
implies that authorization is not required.
46+
**Authentication:** A list to select authentication type.
47+
* NO_AUTH: _No Authentication used_
48+
* BASIC_AUTH: _Username and password will be Base 64 encoded_
49+
* BASIC_AUTH Jenkins CSRF Protection (crumb): _Username and password will
50+
be Base 64 encoded. A crumb will be fetched automatically before request is made.
51+
(Currently default in many Jenkins instances). **Note**: Will work even when CSRF
52+
is disabled in Jenkins._
53+
54+
<img border="1" src="images/subscription_add_part4.png">
55+
</img>
4656

4757
**Repeat:** It is possible to enable repeat, e.g. whether same subscription
4858
should be re-triggered for new additions to the aggregated object. If disabled,
4959
the notification will be triggered only the first time when conditions are
5060
fulfilled.
5161

52-
**Requirement:** It is used to add a requirement, which need to be fulfilled
53-
before a subscription is triggered. Requirement is added in the form of a
54-
condition (with a specific format). More than one conditions may be added under
55-
one requirement by using “Add Condition” button. It should be noted that
56-
conditions under one requirement are connected by logical “AND”. Thus all
57-
conditions udder one requirement need to be satisfied before a subscription is
58-
triggered. More than one requirements may be added by “Add Requirement” button.
62+
**Requirement and Conditions:** It is used to add a requirement, which need to
63+
be fulfilled before a subscription is triggered. Requirement is added in the form
64+
of a condition (with a specific format). More than one conditions may be added
65+
under one requirement by using “Add Condition” button. It should be noted
66+
that conditions under one requirement are connected by logical “AND”.
67+
Thus all conditions udder one requirement need to be satisfied before a subscription
68+
is triggered. More than one requirements may be added by “Add Requirement” button.
5969
Requirements are connected by logical “OR”.
70+
**_More information about how to write Requirement and Conditions can be found [here](https://github.com/eiffel-community/eiffel-intelligence/blob/master/wiki/markdown/subscriptions.md#writing-requirements-and-conditions)._**
-66.2 KB
Binary file not shown.
-33.2 KB
Binary file not shown.
33.9 KB
Loading
45.9 KB
Loading
19.7 KB
Loading

0 commit comments

Comments
 (0)