From a9e74086bf21afa63934aeef71c0e0bc49bd148d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Wed, 12 Jan 2022 16:35:58 +0000 Subject: [PATCH] fix: FIDO registration on localhost environments --- .../graphql/modules/authentication/FIDO2FAStrategy.js | 4 ++-- .../modules/authentication/FIDOPasswordlessStrategy.js | 4 ++-- .../modules/authentication/FIDOUsernamelessStrategy.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/new-admin/graphql/modules/authentication/FIDO2FAStrategy.js b/lib/new-admin/graphql/modules/authentication/FIDO2FAStrategy.js index 82cd4ee1..8b399e44 100644 --- a/lib/new-admin/graphql/modules/authentication/FIDO2FAStrategy.js +++ b/lib/new-admin/graphql/modules/authentication/FIDO2FAStrategy.js @@ -13,8 +13,8 @@ const devMode = require('minimist')(process.argv.slice(2)).dev const REMEMBER_ME_AGE = 90 * T.day -const rpID = devMode ? `localhost:3001` : domain -const expectedOrigin = `https://${rpID}` +const rpID = domain +const expectedOrigin = `https://${rpID}${devMode ? `:3001` : ``}` const generateAttestationOptions = (session, options) => { return users.getUserById(options.userId).then(user => { diff --git a/lib/new-admin/graphql/modules/authentication/FIDOPasswordlessStrategy.js b/lib/new-admin/graphql/modules/authentication/FIDOPasswordlessStrategy.js index 8c39e624..b31d3277 100644 --- a/lib/new-admin/graphql/modules/authentication/FIDOPasswordlessStrategy.js +++ b/lib/new-admin/graphql/modules/authentication/FIDOPasswordlessStrategy.js @@ -12,8 +12,8 @@ const devMode = require('minimist')(process.argv.slice(2)).dev const REMEMBER_ME_AGE = 90 * T.day -const rpID = devMode ? `localhost:3001` : domain -const expectedOrigin = `https://${rpID}` +const rpID = domain +const expectedOrigin = `https://${rpID}${devMode ? `:3001` : ``}` const generateAttestationOptions = (session, options) => { return users.getUserById(options.userId).then(user => { diff --git a/lib/new-admin/graphql/modules/authentication/FIDOUsernamelessStrategy.js b/lib/new-admin/graphql/modules/authentication/FIDOUsernamelessStrategy.js index 2a1ee59a..8d1ae4ec 100644 --- a/lib/new-admin/graphql/modules/authentication/FIDOUsernamelessStrategy.js +++ b/lib/new-admin/graphql/modules/authentication/FIDOUsernamelessStrategy.js @@ -12,8 +12,8 @@ const devMode = require('minimist')(process.argv.slice(2)).dev const REMEMBER_ME_AGE = 90 * T.day -const rpID = devMode ? `localhost:3001` : domain -const expectedOrigin = `https://${rpID}` +const rpID = domain +const expectedOrigin = `https://${rpID}${devMode ? `:3001` : ``}` const generateAttestationOptions = (session, options) => { return credentials.getHardwareCredentials().then(devices => {