From 340ce078ffa4ef44c129bee275dd27c4c0769ac4 Mon Sep 17 00:00:00 2001 From: g-otn <44736064+g-otn@users.noreply.github.com> Date: Tue, 7 Nov 2023 19:04:13 -0300 Subject: [PATCH] create: README.md, sync improvements --- README.md | 5 +++++ index.js | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..bb42e0b --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# lambda-authorizer-client + +Lambda authorizer which validates JWT signature and claims. Specific to client ordering flow. + +Part of a group course project of a self service and kitchen management system for a fictional fast food restaurant. diff --git a/index.js b/index.js index 629a51c..52ad21d 100644 --- a/index.js +++ b/index.js @@ -29,14 +29,14 @@ exports.handler = async (event) => { jwtSettings.options ); - if (decoded.sub == null) { - console.log('Missing sub claim'); + if (!decoded.sub || !Number(decoded.sub)) { + console.log('Missing or invalid sub claim'); return { isAuthorized: false }; } return { isAuthorized: true }; } catch (error) { - console.log('Token validation failed', token); + console.log('Token verification failed', token); return { isAuthorized: false }; } };