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 }; } };