Skip to content

Commit fe1f961

Browse files
committed
Fixing OAuth support as Atlassian provider only supports RSA-SHA1
1 parent 6429788 commit fe1f961

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

lib/jira.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
// * `Jira API Version<string>`: Known to work with `2` and `2.0.alpha1`
5050
// * `verbose<bool>`: Log some info to the console, usually for debugging
5151
// * `strictSSL<bool>`: Set to false if you have self-signed certs or something non-trustworthy
52-
// * `oauth`: A dictionary of `consumer_key`, `consumer_secret`, `access_token` and `access_token_secret` to be used for OAuth authentication.
52+
// * `oauth`: A dictionary of `consumer_key`, `consumer_secret`, `access_token` and `access_token_secret` to be used for OAuth authentication. Optional signature_method, but Atlassian uses RSA-SHA1.
5353
// * `base`: Add base slug if your JIRA install is not at the root of the host
5454
//
5555
// ## Implemented APIs ##
@@ -182,7 +182,8 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
182182
consumer_key: oauth.consumer_key,
183183
consumer_secret: oauth.consumer_secret,
184184
token: oauth.access_token,
185-
token_secret: oauth.access_token_secret
185+
token_secret: oauth.access_token_secret,
186+
signature_method: oauth.signature_method || 'RSA-SHA1'
186187
};
187188
} else if(this.username && this.password) {
188189
options.auth = {
@@ -1268,7 +1269,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
12681269

12691270
});
12701271
};
1271-
1272+
12721273
// ## Add component to Jira ##
12731274
// ### Takes ###
12741275
//
@@ -1289,29 +1290,29 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
12891290
json: true,
12901291
body: component
12911292
};
1292-
1293+
12931294
this.doRequest(options, function (error, response, body) {
1294-
1295+
12951296
if (error) {
12961297
callback(error, null);
12971298
return;
12981299
}
1299-
1300+
13001301
if (response.statusCode === 400) {
13011302
callback(body);
13021303
return;
13031304
}
1304-
1305+
13051306
if ((response.statusCode !== 200) && (response.statusCode !== 201)) {
13061307
callback(response.statusCode + ': Unable to connect to JIRA during search.');
13071308
return;
13081309
}
1309-
1310+
13101311
callback(null, body);
13111312

13121313
});
13131314
};
1314-
1315+
13151316
// ## Delete component to Jira ##
13161317
// ### Takes ###
13171318
//
@@ -1331,19 +1332,19 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
13311332
followAllRedirects: true,
13321333
json: true
13331334
};
1334-
1335+
13351336
this.doRequest(options, function (error, response) {
1336-
1337+
13371338
if (error) {
13381339
callback(error, null);
13391340
return;
13401341
}
1341-
1342+
13421343
if (response.statusCode === 204) {
13431344
callback(null, "Success");
13441345
return;
13451346
}
1346-
1347+
13471348
callback(response.statusCode + ': Error while deleting');
13481349

13491350
});
@@ -1656,7 +1657,7 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
16561657
callback("Invalid Fields: " + JSON.stringify(body));
16571658
return;
16581659
};
1659-
1660+
16601661
callback(response.statusCode + ': Error while adding comment');
16611662
});
16621663
};

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
}
2424
],
2525
"dependencies": {
26-
"request": "<2.16.0",
27-
"oauth": "^0.9.11"
26+
"request": "^2.69.0"
2827
},
2928
"scripts": {
3029
"test": "grunt test"

0 commit comments

Comments
 (0)