Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"json-diff": "1.0.0",
"jsonapi-serializer": "3.6.2",
"jsonwebtoken": "8.5.1",
"jwt-decode": "2.2.0",
"lodash": "4.17.21",
"mkdirp": "1.0.4",
"mongodb": "4.17.2",
Expand Down
2 changes: 1 addition & 1 deletion src/context/dependencies-plan.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = plan =>
planInquirer.addInstance('inquirer', () => require('inquirer')),
)
.addPackage('jwtDecode', planJWTDecode =>
planJWTDecode.addInstance('jwtDecode', () => require('jwt-decode')),
planJWTDecode.addInstance('jwtDecode', () => require('jsonwebtoken').decode),
)
.addPackage('others', planOthers =>
planOthers
Expand Down
1 change: 0 additions & 1 deletion src/services/authenticator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const ApplicationError = require('../errors/application-error');
const { ERROR_UNEXPECTED } = require('../utils/messages');

/**
* @class
* @param {import('../context/plan').Context} context
Expand Down
11 changes: 7 additions & 4 deletions test/fixtures/api.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const nock = require('nock');
const jwt = require('jsonwebtoken');
const ProjectSerializer = require('../../src/serializers/project');
const EnvironmentSerializer = require('../../src/serializers/environment');
const JobSerializer = require('../../src/serializers/job');
const { default: Agents } = require('../../src/utils/agents');

const SIGNED_JWT_TOKEN =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3MDk5MDUwMTgsImV4cCI6MTcwOTk5MTQxOH0.EuQsuKhEGyEm4MXCZKMuFyk6V9bDM8wnrWcZ05mnp0c';
/**
* @param {import('nock').Scope} nockScope
*/
Expand Down Expand Up @@ -146,7 +147,7 @@ function authenticationSucceeded(scope) {
'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Adevice_code&device_code=DEVICE-CODE&client_id=the-client-id',
)
.reply(200, {
access_token: jwt.sign({}, 'key', { expiresIn: '1day' }),
access_token: SIGNED_JWT_TOKEN,
});
}

Expand All @@ -169,7 +170,7 @@ function createAuthenticationToken(scope) {
data: {
id: 42,
attributes: {
token: jwt.sign({}, 'key', { expiresIn: '1day' }),
token: SIGNED_JWT_TOKEN,
},
},
});
Expand Down Expand Up @@ -203,7 +204,9 @@ module.exports = {
loginValid: () =>
nock('http://localhost:3001')
.post('/api/sessions', { email: '[email protected]', password: 'valid_pwd' })
.reply(200, { token: jwt.sign({}, 'key', { expiresIn: '1day' }) }),
.reply(200, {
token: SIGNED_JWT_TOKEN,
}),

loginInvalid: () =>
nock('http://localhost:3001')
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8065,11 +8065,6 @@ jws@^4.0.0:
jwa "^2.0.0"
safe-buffer "^5.0.1"

[email protected]:
version "2.2.0"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-2.2.0.tgz#7d86bd56679f58ce6a84704a657dd392bba81a79"
integrity sha512-86GgN2vzfUu7m9Wcj63iUkuDzFNYFVmjeDm2GzWpUk+opB0pEpMsw6ePCMrhYkumz2C1ihqtZzOMAg7FiXcNoQ==

keytar@^7.3.0:
version "7.9.0"
resolved "https://registry.yarnpkg.com/keytar/-/keytar-7.9.0.tgz#4c6225708f51b50cbf77c5aae81721964c2918cb"
Expand Down