New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

atlassian-oauth2

Package Overview
Dependencies
Maintainers
5
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atlassian-oauth2 - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

26

lib/oauth2.js

@@ -1,2 +0,2 @@

var request = require('request'),
var fetch = require('node-fetch'),
RSVP = require('rsvp'),

@@ -86,18 +86,18 @@ jwt = require('atlassian-jwt');

request({
var url = (opts.authorizationServerBaseUrl || AUTHORIZATION_SERVER_URL) + (opts.authorizationPath || '/oauth2/token');
fetch(url, {
method: 'POST',
url: (opts.authorizationServerBaseUrl || AUTHORIZATION_SERVER_URL) + (opts.authorizationPath || '/oauth2/token'),
form: formData,
json: true,
body: JSON.stringify(formData),
headers: {
"accept": "application/json"
"Accept": "application/json",
'Content-Type': 'application/x-www-form-urlencoded'
}
}, function(err, response, body) {
if (err) {
reject(err);
} else if (response.statusCode < 200 || response.statusCode > 299) {
reject(body);
} else {
resolve(body);
}).then(function(res) {
if (res.status < 200 || res.status > 299) {
reject(res.body);
}
resolve(res.body);
}).catch(function(err){
reject(err);
});

@@ -104,0 +104,0 @@ });

{
"name": "atlassian-oauth2",
"description": "Atlassian Connect OAuth2 library",
"version": "0.4.2",
"version": "0.5.0",
"author": "Seb Ruiz <sruiz@atlassian.com>",

@@ -12,3 +12,3 @@ "repository": {

"atlassian-jwt": "^1.0.2",
"request": "^2.88.0",
"node-fetch": "^2.6.7",
"rsvp": "^4.8.4"

@@ -25,3 +25,4 @@ },

"scripts": {
"test": "mocha test/*.js"
"test": "mocha test/*.js",
"test:watch": "mocha --watch test/*.js"
},

@@ -28,0 +29,0 @@ "license": "MIT",

@@ -137,3 +137,3 @@ var should = require('should'),

interceptRequest(done, function () {
this.req.headers.accept.should.be.eql("application/json");
this.req.headers.accept[0].should.be.eql("application/json");
});

@@ -144,3 +144,3 @@ });

interceptRequest(done, function () {
this.req.headers['content-type'].should.be.eql("application/x-www-form-urlencoded");
this.req.headers['content-type'][0].should.be.eql("application/x-www-form-urlencoded");
});

@@ -151,10 +151,10 @@ });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
body.grant_type.should.be.eql('urn:ietf:params:oauth:grant-type:jwt-bearer');
});
});
it('Request assertion exists', function (done) {
interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
should.exist(body.assertion);

@@ -166,3 +166,3 @@ });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
should.exist(jwt.decode(body.assertion, sharedSecret).iss);

@@ -175,3 +175,3 @@ });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
jwt.decode(body.assertion, sharedSecret).aud.should.be.eql([customAuthUrl]);

@@ -199,3 +199,3 @@ }, { authorizationServerBaseUrl: customAuthUrl });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
should.not.exist(body.scope);

@@ -207,3 +207,3 @@ }, { scopes: false });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
body.scope.should.be.eql('READ');

@@ -215,3 +215,3 @@ }, { scopes: ['READ'] });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
body.scope.should.be.eql('READ WRITE');

@@ -223,3 +223,3 @@ }, { scopes: ['READ', 'WRITE'] });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
body.scope.should.be.eql('WRITE READ');

@@ -231,3 +231,3 @@ }, { scopes: ['WRITE', 'READ'] });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
body.scope.should.be.eql('READ WRITE');

@@ -239,3 +239,3 @@ }, { scopes: ['READ WRITE'] });

interceptRequest(done, function (uri, requestBody) {
var body = qs.parse(requestBody);
var body = qs.parse(JSON.parse(requestBody));
body.scope.should.be.eql('READ WRITE');

@@ -242,0 +242,0 @@ }, { scopes: ['read', 'WriTe'] });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc