atlassian-connect-auth
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -6,3 +6,3 @@ const jwt = require('atlassian-jwt') | ||
class Addon { | ||
constructor({ product, baseUrl }) { | ||
constructor ({ product, baseUrl }) { | ||
this.product = product | ||
@@ -12,3 +12,3 @@ this.baseUrl = baseUrl | ||
async install(req, { loadCredentials, saveCredentials }) { | ||
async install (req, { loadCredentials, saveCredentials }) { | ||
const id = util.extractId(req) | ||
@@ -46,3 +46,3 @@ const token = util.extractToken(req, this.product) | ||
async auth(req, { skipQsh, loadCredentials }) { | ||
async auth (req, { skipQsh, loadCredentials }) { | ||
const token = util.extractToken(req, this.product) | ||
@@ -70,2 +70,2 @@ if (!token) { | ||
module.exports = Addon | ||
module.exports = Addon |
const jwt = require('atlassian-jwt') | ||
const AuthError = require('./AuthError') | ||
function extractToken(req) { | ||
const token = req.headers['authorization'] || '' | ||
function extractToken (req) { | ||
const token = req.headers.authorization || req.query.jwt || '' | ||
return token.replace(/^JWT /, '') | ||
@@ -51,3 +51,3 @@ } | ||
validateQsh, | ||
validateToken, | ||
} | ||
validateToken | ||
} |
{ | ||
"name": "atlassian-connect-auth", | ||
"version": "1.0.1", | ||
"description": "", | ||
"version": "1.0.2", | ||
"description": "Helper for handling webhooks from Atlassian products", | ||
"main": "lib/index.js", | ||
@@ -40,3 +40,3 @@ "directories": { | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-node": "^5.2.0", | ||
"eslint-plugin-node": "^5.2.1", | ||
"eslint-plugin-promise": "^3.6.0", | ||
@@ -43,0 +43,0 @@ "eslint-plugin-standard": "^3.0.1" |
@@ -15,3 +15,3 @@ # atlassian-connect-auth | ||
await addon.install(req, { | ||
loadCredentials: clientKey => model.Credentials.findOne({ clientKey }), | ||
loadCredentials: clientKey => model.Credentials.findOne({ where: { clientKey } }), | ||
saveCredentials: (clientKey, newCredentials, storedCredentials) => { | ||
@@ -41,3 +41,3 @@ if (storedCredentials) { | ||
await addon.auth(req, { | ||
loadCredentials: clientKey => model.Credentials.findOne({ clientKey }) | ||
loadCredentials: clientKey => model.Credentials.findOne({ where: { clientKey } }) | ||
}) | ||
@@ -44,0 +44,0 @@ |
16965
8
102