Skip to content

Commit

Permalink
fix merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
aatuny committed Nov 21, 2024
1 parent d8bf1e0 commit 7b76026
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
},
"dependencies": {
"@babel/register": "^7.24.6",
"debug": "^4.3.7",
"http-status": "^1.7.4",
"jsonwebtoken": "^9.0.2",
"node-fetch": "^2.7.0",
Expand Down
6 changes: 6 additions & 0 deletions src/strategies/bearer-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import crypto from 'crypto';

import createDebugLogger from 'debug';
import HttpStatus from 'http-status';
import jwt from 'jsonwebtoken';
import fetch from 'node-fetch';
Expand All @@ -39,7 +40,10 @@ export default class extends Strategy {

// eslint-disable-next-line max-statements
async authenticate(req) {
const debug = createDebugLogger('@natlibfi/passport-keycloak-js/bearer-token:authenticate');

try {

const token = getToken(req);
const serviceToken = this.serviceAuthHeader ? getServiceToken(req, this.serviceAuthHeader) : null;

Expand Down Expand Up @@ -70,6 +74,8 @@ export default class extends Strategy {

return this.success(userInfo);
} catch (err) {
debug(err);

if (err instanceof TokenValidationError) { // eslint-disable-line functional/no-conditional-statements
return this.fail();
}
Expand Down
5 changes: 5 additions & 0 deletions src/strategies/cookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import crypto from 'crypto';

import createDebugLogger from 'debug';
import HttpStatus from 'http-status';
import jwt from 'jsonwebtoken';
import fetch from 'node-fetch';
Expand All @@ -41,6 +42,8 @@ export default class extends Strategy {

// eslint-disable-next-line max-statements
async authenticate(req) {
const debug = createDebugLogger('@natlibfi/passport-keycloak-js/bearer-token:authenticate');

try {
const cookie = getCookie(req, this.cookieName);
if (cookie === null) {
Expand All @@ -61,6 +64,8 @@ export default class extends Strategy {

return this.success(userInfo);
} catch (err) {
debug(err);

if (err instanceof TokenValidationError) { // eslint-disable-line functional/no-conditional-statements
return this.fail();
}
Expand Down

0 comments on commit 7b76026

Please sign in to comment.