atlassian-jwt
Advanced tools
Comparing version 0.1.3 to 0.1.4
@@ -171,7 +171,7 @@ /* | ||
var path; | ||
// In express 4.x req.baseUrl represents the full URL and req.path represents the URL from the last router (https://expressjs.com/en/4x/api.html#req.baseUrl) | ||
if (req.baseUrl) { | ||
path = url.parse(req.baseUrl).pathname; | ||
// req.originalUrl represents the full URL and req.path represents the URL from the last router (https://expressjs.com/en/4x/api.html#req.originalUrl) | ||
if (req.originalUrl) { | ||
path = url.parse(req.originalUrl).pathname; | ||
} else { | ||
// Since req.baseUrl doesn't exist in prior versions of express we fall back to req.path | ||
// Since some people depend on the lib without using real req object but rather mock them, we need this fallback for it to not break. | ||
path = req.path; | ||
@@ -178,0 +178,0 @@ } |
{ | ||
"name": "atlassian-jwt", | ||
"description": "JWT (JSON Web Token) implementation with custom Atlassian QSH claim verification", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"author": "Seb Ruiz <sruiz@atlassian.com>", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -26,3 +26,3 @@ # atlassian-jwt | ||
method: 'GET', | ||
path: '/rest/resource/you/want' | ||
originalUrl: '/rest/resource/you/want' | ||
}; | ||
@@ -29,0 +29,0 @@ |
@@ -26,3 +26,3 @@ var assert = require('assert'); | ||
method: 'get', | ||
baseUrl: '/path/to/service', | ||
originalUrl: '/path/to/service', | ||
query: qs.parse('zee_last=param&repeated=parameter 1&first=param&repeated=parameter 2&repeated=Parameter 2') | ||
@@ -41,3 +41,3 @@ }; | ||
method: 'get', | ||
baseUrl: '/base/path/to/service', | ||
originalUrl: '/base/path/to/service', | ||
query: qs.parse('zee_last=param&repeated=parameter 1&first=param&repeated=parameter 2&repeated=Parameter 2') | ||
@@ -56,3 +56,3 @@ }; | ||
method: 'get', | ||
baseUrl: '/hello-world', | ||
originalUrl: '/hello-world', | ||
query: qs.parse('lic=none&tz=Australia%2FSydney&cp=%2Fjira&user_key=&loc=en-US&user_id=&jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEzODY4OTkxMzEsImlzcyI6ImppcmE6MTU0ODk1OTUiLCJxc2giOiI4MDYzZmY0Y2ExZTQxZGY3YmM5MGM4YWI2ZDBmNjIwN2Q0OTFjZjZkYWQ3YzY2ZWE3OTdiNDYxNGI3MTkyMmU5IiwiaWF0IjoxMzg2ODk4OTUxfQ.uKqU9dTB6gKwG6jQCuXYAiMNdfNRw98Hw_IWuA5MaMo&xdm_e=http%3A%2F%2Fstorm%3A2990&xdm_c=channel-servlet-hello-world&xdm_p=1') | ||
@@ -71,3 +71,3 @@ }; | ||
method: 'get', | ||
baseUrl: '/hello-world', | ||
originalUrl: '/hello-world', | ||
query: qs.parse('a&b=foo&c') | ||
@@ -85,3 +85,3 @@ }; | ||
method: 'post', | ||
baseUrl: '/jira/rest/api/2/project/jira&a=b&c=d', | ||
originalUrl: '/jira/rest/api/2/project/jira&a=b&c=d', | ||
query: qs.parse('x=y'), | ||
@@ -100,3 +100,3 @@ body: '' | ||
path: '/project', | ||
baseUrl: '/jira/rest/api/2/project/jira', | ||
originalUrl: '/jira/rest/api/2/project/jira', | ||
query: qs.parse('x=y'), | ||
@@ -109,13 +109,2 @@ }; | ||
it('should fall back to req.path if req.baseUrl does not exist', function(done){ | ||
var req = { | ||
method: 'get', | ||
path: '/jira/rest/api/2/project/jira', | ||
query: qs.parse('x=y'), | ||
}; | ||
assert.equal(jwt.createCanonicalRequest(req, false, '/jira'), 'GET&/rest/api/2/project/jira&x=y'); | ||
done(); | ||
}); | ||
// If the separator is not URL encoded then the following URLs have the same query-string-hash: | ||
@@ -129,3 +118,3 @@ // https://djtest9.jira-dev.com/rest/api/2/project&a=b?x=y | ||
method: 'post', | ||
baseUrl: '/rest/api/2/project&a=b', | ||
originalUrl: '/rest/api/2/project&a=b', | ||
query: qs.parse('x=y'), | ||
@@ -136,3 +125,3 @@ body: '' | ||
method: 'post', | ||
baseUrl: '/rest/api/2/project', | ||
originalUrl: '/rest/api/2/project', | ||
query: qs.parse('a=b&x=y'), | ||
@@ -149,3 +138,3 @@ body: '' | ||
method: 'post', | ||
baseUrl: '/rest/api/2/project&a=b', | ||
originalUrl: '/rest/api/2/project&a=b', | ||
query: qs.parse('x=y'), | ||
@@ -162,3 +151,3 @@ body: '' | ||
method: 'post', | ||
baseUrl: '/rest/api/2/project&a=b&c=d', | ||
originalUrl: '/rest/api/2/project&a=b&c=d', | ||
query: qs.parse('x=y'), | ||
@@ -178,3 +167,3 @@ body: '' | ||
method: 'get', | ||
baseUrl: '/path' | ||
originalUrl: '/path' | ||
}; | ||
@@ -204,3 +193,3 @@ var expectedHash = "799be84a7fa35570087163c0cd9af3abff7ac05c2c12ba0bb1d7eebc984b3ac2"; | ||
method: 'get', | ||
baseUrl: '/' | ||
originalUrl: '/' | ||
}; | ||
@@ -218,3 +207,3 @@ var expectedHash = "c88caad15a1c1a900b8ac08aa9686f4e8184539bea1deda36e2f649430df3239"; | ||
method: 'get', | ||
baseUrl: '/hello-world', | ||
originalUrl: '/hello-world', | ||
query: qs.parse('lic=none&tz=Australia%2FSydney&cp=%2Fjira&user_key=&loc=en-US&user_id=&jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEzODY5MTEzNTYsImlzcyI6ImppcmE6MTU0ODk1OTUiLCJxc2giOiI4MDYzZmY0Y2ExZTQxZGY3YmM5MGM4YWI2ZDBmNjIwN2Q0OTFjZjZkYWQ3YzY2ZWE3OTdiNDYxNGI3MTkyMmU5IiwiaWF0IjoxMzg2OTExMTc2fQ.rAsxpHv0EvpXkhjnZnSV14EXJgDx3KSQjgYRjfKnFt8&xdm_e=http%3A%2F%2Fstorm%3A2990&xdm_c=channel-servlet-hello-world&xdm_p=1') | ||
@@ -233,3 +222,3 @@ }; | ||
method: 'post', | ||
baseUrl: '/hello-world', | ||
originalUrl: '/hello-world', | ||
query: {}, | ||
@@ -249,3 +238,3 @@ body: qs.parse('lic=none&tz=Australia%2FSydney&cp=%2Fjira&user_key=&loc=en-US&user_id=&jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEzODY5MTEzNTYsImlzcyI6ImppcmE6MTU0ODk1OTUiLCJxc2giOiI4MDYzZmY0Y2ExZTQxZGY3YmM5MGM4YWI2ZDBmNjIwN2Q0OTFjZjZkYWQ3YzY2ZWE3OTdiNDYxNGI3MTkyMmU5IiwiaWF0IjoxMzg2OTExMTc2fQ.rAsxpHv0EvpXkhjnZnSV14EXJgDx3KSQjgYRjfKnFt8&xdm_e=http%3A%2F%2Fstorm%3A2990&xdm_c=channel-servlet-hello-world&xdm_p=1') | ||
method: 'post', | ||
baseUrl: '/hello-world', | ||
originalUrl: '/hello-world', | ||
query: {}, | ||
@@ -252,0 +241,0 @@ body: qs.parse('lic=none&tz=Australia%2FSydney&cp=%2Fjira&user_key=&loc=en-US&user_id=&jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjEzODY5MTEzNTYsImlzcyI6ImppcmE6MTU0ODk1OTUiLCJxc2giOiI4MDYzZmY0Y2ExZTQxZGY3YmM5MGM4YWI2ZDBmNjIwN2Q0OTFjZjZkYWQ3YzY2ZWE3OTdiNDYxNGI3MTkyMmU5IiwiaWF0IjoxMzg2OTExMTc2fQ.rAsxpHv0EvpXkhjnZnSV14EXJgDx3KSQjgYRjfKnFt8&xdm_e=http%3A%2F%2Fstorm%3A2990&xdm_c=channel-servlet-hello-world&xdm_p=1') |
@@ -48,3 +48,3 @@ /** | ||
method: "GET", | ||
baseUrl: uri.path(), | ||
originalUrl: uri.path(), | ||
query: queryString | ||
@@ -51,0 +51,0 @@ }; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
64260
846