{"_id":"@goodgamestudios/aws-jwt-authorizer","_rev":"42-42ddd8128833328c5173cc25bda05228","name":"@goodgamestudios/aws-jwt-authorizer","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@goodgamestudios/aws-jwt-authorizer","version":"0.0.1","keywords":["aws","sls","lambda","authorizer","jwt"],"author":{"url":"https://github.com/AndreasPizsa","name":"Andreas Pizsa","email":"hopster@gmail.com"},"license":"ISC","_id":"@goodgamestudios/aws-jwt-authorizer@0.0.1","maintainers":[{"name":"sudobangbang","email":"605h4n@gmail.com"},{"name":"oaly-ggs","email":"oaly@goodgamestudios.com"},{"name":"chadestioco","email":"cestioco@goodgamestudios.com"},{"name":"igorbabkin_ggs","email":"ibabkin@goodgamestudios.com"},{"name":"jenkinsempire-ggs","email":"jenkinsempire@goodgamestudios.com"},{"name":"mabdallah-ggs","email":"mabdallah@goodgamestudios.com"},{"name":"amartin-ggs","email":"amartin@goodgamestudios.com"},{"name":"rschmidt-ggs","email":"rschmidt@goodgamestudios.com"},{"name":"ssydorenko-ggs","email":"ssydorenko@goodgamestudios.com"},{"name":"vtenekedzhiev-ggs","email":"vtenekedzhiev@goodgamestudios.com"},{"name":"tschrader-ggs","email":"tschrader@goodgamestudios.com"},{"name":"goodgame","email":"html5@goodgamestudios.com"},{"name":"jenkinshtml5migra","email":"boczujda@goodgamestudios.com"},{"name":"azeino-ggs","email":"azeino@goodgamestudios.com"},{"name":"ddepaolis-ggs","email":"ddepaolis@goodgamestudios.com"},{"name":"boczujda_ggs","email":"boczujda@goodgamestudios.com"},{"name":"guest-ggs","email":"html5+guest@goodgamestudios.com"},{"name":"ggs-zzhou","email":"zzhou@goodgamestudios.com"},{"name":"andreaspizsa","email":"hopster@gmail.com"},{"name":"cgeisler-ggs","email":"cgeisler@goodgamestudios.com"}],"contributors":[{"url":"https://gitlab.goodgamestudios.com/mabdallah","name":"Mohamed Abdallah","email":"mabdallah@goodgamestudios.com"},{"url":"https://gitlab.goodgamestudios.com/cestioco","name":"Christian Estioco","email":"cestioco@goodgamestudios.com"}],"homepage":"https://gitlab.goodgamestudios.com/apizsa/sls-jwt-authorizer","bugs":{"url":"https://gitlab.goodgamestudios.com/apizsa/sls-jwt-authorizer/issues"},"xo":{"space":true,"extends":["@andreaspizsa/eslint-config-xo"],"semicolon":false},"dist":{"shasum":"74e9082aa153dfcaacec7e205d127d8bda4c9673","tarball":"https://registry.npmjs.org/@goodgamestudios/aws-jwt-authorizer/-/aws-jwt-authorizer-0.0.1.tgz","fileCount":11,"integrity":"sha512-V6VxClJbjlPEzg8tEyTigDFC0NNUzMaMoWzGzQVLVK5SrUScP1R/Px2WkL+2yyzn5C+QwtibmoBpYZwq4jjPVw==","signatures":[{"sig":"MEYCIQCMGd5gwqtE02J1DPW1YGGK9iv/aKcYPSL/NooxXNOxUQIhAJ+DTp+YTmsEMAP08jFJToALKgAbNrTloLboW+DHuroU","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":14478,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd86ZaCRA9TVsSAnZWagAAQfwP/Rs5r1/m9RkU1/nEKlfn\nqe9uUaTEQI5rPzI/YPCzYAM68jUGBYXHs4mAgGu6NDlW9spKOjcHrtqrtPzK\nW5O5dv+wWLuB1AYBt+Tj96VLDpsx5b44ZheT8e9vFnNWrWEpz8G9+1JGevz4\nB0qlYKhtXc8sMOSLp2lQ19VhKSFoyBFWEHoFCRjcaO3l4qHmk0vt6MK4M3ue\nMf8HrUuGotZ81/Nl5xN/wI8DwR/boUAUnOIdfeIJrADsgubCTOQaQ/Q6CjDA\nttKesQ6oEWzgixoON05W4EgSD1uxg+DVrSilONDI7xZnsq84z54GY4KKKjNc\nORg6jEC2rlwdpHdqXdhQnEIvVRJ1j1C/u2JM0cTjA9I4Yxxf4Vb6amnTsxST\nSSL870Pr71igkj70N81JgJQNeuYBtiAczsPrH/+eW1xvBNK9j4pRNn2WySgV\nQDA40hX86AVQQh0/TYZ4A8UFLOYHG72farXwyRhc2szMw49/p2/Vi4LzeH5l\nkvNklGgb5T+x3ruxPCvURr+nYwGSQDwcgJQuQcm+WY1/APFqXrm3GJZGSZio\nf+0SlUyV9C+gsp2jN862F4VAcVh6it64pDgUa/wWax4zjbpjG0hZTfRfgOB3\n/oaGWVaJIE03gMPKBmlPZhJGerhw1W/iWtsEDw+iru5EOHmFcfNrOfVulo6D\ntFf6\r\n=q2Fi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"gitHead":"ef839f39d73cbc2a02265ddcd32df6eb1e7f2830","private":false,"release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator",["@semantic-release/gitlab",{"gitlabUrl":"https://gitlab.goodgamestudios.com"}],"@semantic-release/npm"]},"scripts":{"test":"nyc ava","pretest":"xo","release":"semantic-release"},"_npmUser":{"name":"andreaspizsa","email":"hopster@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git@gitlab.goodgamestudios.com:apizsa/aws-jwt-authorizer.git","type":"git"},"_npmVersion":"6.10.2","description":"A flexible JWT Authorizer for Serverless functions","directories":{},"_nodeVersion":"12.7.0","dependencies":{"ms":"^2.1.2","mem":"^6.0.1","aws-sdk":"^2.588.0","p-timeout":"^3.2.0","jsonwebtoken":"^8.5.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.25.3","ava":"^2.4.0","nyc":"^14.1.1","husky":"^3.1.0","finepack":"^2.10.0","@commitlint/cli":"^8.2.0","semantic-release":"^15.13.31","@semantic-release/gitlab":"^4.0.4","@andreaspizsa/eslint-config-xo":"^0.1.2","@commitlint/config-conventional":"^8.2.0"},"_npmOperationalInternal":{"tmp":"tmp/aws-jwt-authorizer_0.0.1_1576248921656_0.9759538372121013","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@goodgamestudios/aws-jwt-authorizer","version":"0.0.2","keywords":["aws","sls","lambda","authorizer","jwt"],"author":{"url":"https://github.com/AndreasPizsa","name":"Andreas Pizsa","email":"hopster@gmail.com"},"license":"ISC","_id":"@goodgamestudios/aws-jwt-authorizer@0.0.2","maintainers":[{"name":"amartin-ggs","email":"amartin@goodgamestudios.com"},{"name":"andreaspizsa","email":"hopster@gmail.com"},{"name":"azeino-ggs","email":"azeino@goodgamestudios.com"},{"name":"boczujda_ggs","email":"boczujda@goodgamestudios.com"},{"name":"cgeisler-ggs","email":"cgeisler@goodgamestudios.com"},{"name":"chadestioco","email":"cestioco@goodgamestudios.com"},{"name":"ddepaolis-ggs","email":"ddepaolis@goodgamestudios.com"},{"name":"ggs-zzhou","email":"zzhou@goodgamestudios.com"},{"name":"goodgame","email":"html5@goodgamestudios.com"},{"name":"guest-ggs","email":"html5+guest@goodgamestudios.com"},{"name":"igorbabkin_ggs","email":"ibabkin@goodgamestudios.com"},{"name":"jenkinsempire-ggs","email":"jenkinsempire@goodgamestudios.com"},{"name":"jenkinshtml5migra","email":"boczujda@goodgamestudios.com"},{"name":"mabdallah-ggs","email":"mabdallah@goodgamestudios.com"},{"name":"oaly-ggs","email":"oaly@goodgamestudios.com"},{"name":"rschmidt-ggs","email":"rschmidt@goodgamestudios.com"},{"name":"ssydorenko-ggs","email":"ssydorenko@goodgamestudios.com"},{"name":"sudobangbang","email":"605h4n@gmail.com"},{"name":"tschrader-ggs","email":"tschrader@goodgamestudios.com"},{"name":"vtenekedzhiev-ggs","email":"vtenekedzhiev@goodgamestudios.com"}],"contributors":[{"url":"https://gitlab.goodgamestudios.com/mabdallah","name":"Mohamed Abdallah","email":"mabdallah@goodgamestudios.com"},{"url":"https://gitlab.goodgamestudios.com/cestioco","name":"Christian Estioco","email":"cestioco@goodgamestudios.com"}],"homepage":"https://gitlab.goodgamestudios.com/apizsa/sls-jwt-authorizer","bugs":{"url":"https://gitlab.goodgamestudios.com/apizsa/sls-jwt-authorizer/issues"},"xo":{"space":true,"extends":["@andreaspizsa/eslint-config-xo"],"semicolon":false},"dist":{"shasum":"52c797932e4474f19890130431d3dffdebcd35f5","tarball":"https://registry.npmjs.org/@goodgamestudios/aws-jwt-authorizer/-/aws-jwt-authorizer-0.0.2.tgz","fileCount":12,"integrity":"sha512-3Tp7HINEAy44Z7QCQMuqs6DIdWGtfPSs62MWccLThAaDHrSQjqZu7AWdNyf1/hw+9h5ZKPJG2kTFO58evAmAfQ==","signatures":[{"sig":"MEUCICuEVmVdXXxqc1egwW6p1kSQ4Fg3VRvOB80iu6SqLhwIAiEAwuHZf75LY1M+2ms9nMW1gGQD1rl03V242BMnctD/yL4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15672,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh2JI1CRA9TVsSAnZWagAArDkQAIoKHdNyJKar1sWC+iSs\nmUOumIDe/iggtHD7ADm8R4i6NDbgMDm9LIa6Hjg0zulLXkXYbS10BSxRDDgU\nBER5mZozIJB+QwWiq368czvcNTXnPmU7VDAKecemrJGojUlWl3C8Trzv7g7r\npZ4+AX0sc8Lz0/f2+lnZmBxyUKZ1p1i0prOu1sL/AY3wDFKGfGMuy8g0bo0e\nxad+cyvcXLDIInti7rF8GuQhJc/Ia/MD0aWrHakshS3vzsVOX8IiMdeNM55X\nVKySZ04yIk7bM8AQHVmyNtg7E0a+uJ+VqiyjpzdDPa+2sMoo9O0A8V4xPtNl\n7FpQzQ73mK5nXiJ2zgXdp40IFYdW0BHG/nxK6GwvBSW8SifvaWoHVtkSK57u\neuh3E8tts/qZ3bzIWuGT2J+grFcWjXICZ8NUP1zOAXhSLgpoE+4/LVwZzXCn\nAWDie+1JNgm1On2dx3xi1iNriVO6hIOWJSdqO9BOwogDlqnPB7CK+vNItdT8\njrq1NBRVZQ+Zeo1Nx4xd9CfpQ9wtGVz8fZJTxLvOXXTKAqVRkt6LqAAA8mqw\nNykHPU8vrWdRNCr91BEfzDUkSyRPvvGPIcrWIqRnHZm8rLZhmTx44ofIytj3\nnjjRWMtxKWqTXgW48sYTv4dTjIcwo0J52FFXej6c9xHdgB+Ml8N1Z6KNgsAh\nB54Z\r\n=hC3j\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","husky":{"hooks":{"commit-msg":"commitlint -E HUSKY_GIT_PARAMS"}},"gitHead":"4b032b8162735d08ab81d33ae230e89737f0b213","private":false,"release":{"plugins":["@semantic-release/commit-analyzer","@semantic-release/release-notes-generator",["@semantic-release/gitlab",{"gitlabUrl":"https://gitlab.goodgamestudios.com"}],"@semantic-release/npm"]},"scripts":{"test":"nyc ava","pretest":"xo","release":"semantic-release"},"_npmUser":{"name":"andreaspizsa","email":"hopster@gmail.com"},"commitlint":{"extends":["@commitlint/config-conventional"]},"repository":{"url":"git@gitlab.goodgamestudios.com:apizsa/aws-jwt-authorizer.git","type":"git"},"_npmVersion":"6.14.4","description":"A flexible JWT Authorizer for Serverless functions","directories":{},"_nodeVersion":"12.13.0","dependencies":{"ms":"^2.1.2","mem":"^6.0.1","aws-sdk":"^2.588.0","p-timeout":"^3.2.0","jsonwebtoken":"^8.5.1"},"postinstaller":{"see":"https://npmjs.com/postinstaller#readme","add your config here":true},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.25.3","ava":"^2.4.0","nyc":"^14.1.1","husky":"^3.1.0","finepack":"^2.10.0","@commitlint/cli":"^8.2.0","semantic-release":"^15.13.31","@semantic-release/gitlab":"^4.0.4","@andreaspizsa/eslint-config-xo":"^0.1.2","@commitlint/config-conventional":"^8.2.0"},"_npmOperationalInternal":{"tmp":"tmp/aws-jwt-authorizer_0.0.2_1587551414397_0.16918024834344858","host":"s3://npm-registry-packages"}}},"time":{"created":"2019-12-13T14:55:21.516Z","modified":"2025-11-25T15:07:53.405Z","0.0.1":"2019-12-13T14:55:21.784Z","0.0.2":"2020-04-22T10:30:14.619Z"},"bugs":{"url":"https://gitlab.goodgamestudios.com/apizsa/sls-jwt-authorizer/issues"},"author":{"url":"https://github.com/AndreasPizsa","name":"Andreas Pizsa","email":"hopster@gmail.com"},"license":"ISC","homepage":"https://gitlab.goodgamestudios.com/apizsa/sls-jwt-authorizer","keywords":["aws","sls","lambda","authorizer","jwt"],"repository":{"url":"git@gitlab.goodgamestudios.com:apizsa/aws-jwt-authorizer.git","type":"git"},"description":"A flexible JWT Authorizer for Serverless functions","contributors":[{"url":"https://gitlab.goodgamestudios.com/mabdallah","name":"Mohamed Abdallah","email":"mabdallah@goodgamestudios.com"},{"url":"https://gitlab.goodgamestudios.com/cestioco","name":"Christian Estioco","email":"cestioco@goodgamestudios.com"}],"maintainers":[{"email":"rschmidt@goodgamestudios.com","name":"rschmidt-ggs"},{"email":"ssydorenko@goodgamestudios.com","name":"ssydorenko-ggs"},{"email":"tim.schrader@stillfront.com","name":"tschrader-ggs"},{"email":"html5@goodgamestudios.com","name":"goodgame"},{"email":"boczujda@goodgamestudios.com","name":"jenkinshtml5migra"},{"email":"html5+guest@goodgamestudios.com","name":"guest-ggs"},{"email":"hopster@gmail.com","name":"andreaspizsa"},{"email":"cgeisler@goodgamestudios.com","name":"cgeisler-ggs"},{"email":"anton.martin@stillfront.com","name":"amartin-ggs"},{"email":"jenkinsempire@goodgamestudios.com","name":"jenkinsempire-ggs"},{"email":"cestioco@goodgamestudios.com","name":"chadestioco"},{"email":"abuhlerschuenemann@goodgamestudios.com","name":"abuhler_ggs"},{"email":"emorozov@goodgamestudios.com","name":"evmoroz"},{"email":"skunkbot@goodgamestudios.com","name":"ggs-skunkbot"},{"email":"stp_engineering@goodgamestudios.com","name":"stp_ci_ggs"},{"email":"it-office@goodgamestudios.com","name":"it_office"},{"email":"sklyarenko@gmail.com","name":"iskliarenko"},{"email":"pverza@goodgamestudios.com","name":"pverza-ggs"},{"email":"rtryputsko-ext@goodgamestudios.com","name":"rtryputsko-ext-ggs"},{"email":"nturai@goodgamestudios.com","name":"ntggs"},{"email":"prosenboom@goodgamestudios.com","name":"prosenboom"},{"email":"amatrosov@goodgamestudios.com","name":"sashamat"},{"email":"mlesanibahri@goodgamestudios.com","name":"mbahri"},{"email":"mschmidt-ext@goodgamestudios.com","name":"mattiassch-gg"},{"email":"dviuranov@goodgamestudios.com","name":"dviuranov-ggs"},{"email":"nvrkic@goodgamestudios.com","name":"nvrkic"},{"email":"rpodlinov@gmail.com","name":"keep_it_simple"}],"readme":"# aws-jwt-authorizer\n\n> A flexible JWT Authorizer function for AWS Lambda\n\n[![pipeline](https://gitlab.goodgamestudios.com/apizsa/aws-jwt-authorizer/badges/master/pipeline.svg)](https://gitlab.goodgamestudios.com/apizsa/aws-jwt-authorizer/commits/master)[![coverage](https://gitlab.goodgamestudios.com/apizsa/aws-jwt-authorizer/badges/master/coverage.svg)](https://gitlab.goodgamestudios.com/apizsa/aws-jwt-authorizer/commits/master)\n\n`aws-jwt-authorizer` is heavily based Mohamed’s [Authorizer](https://gitlab.goodgamestudios.com/e4k/iga/blob/master/jwt-authorizer.js) and [Secrets Manager](https://gitlab.goodgamestudios.com/empire/gameserver-api/blob/master/aws-cached-secretsmanager.js) and Chad’s [`ggs-serverless-jwt`](https://gitlab.goodgamestudios.com/cestioco/ggs-serverless-jwt/tree/master).\n\n**This implementation adds the following:**\n+ The Public Key for JWT verification is:\n  + loaded from Secrets Manager\n  + using a key derived from the Issuer (`iss`) in the JWT\n  + cached in memory for a configurable amount of time\n+ Almost all aspects of the Authorizer are configurable\n+ has automated tests\n\n# Usage\n\n```sh\nnpm add @goodgamestudios/aws-jwt-authorizer\n```\n\nThen modify your `serverless.yml` to make use of this. Add the following\n`function` with a suitable name:\n\n```yaml\nfunction:\n  ...\n  jwt-authorizer:\n    handler: @goodgamestudios/aws-jwt-authorizer\n    name: service_stage_jwt-authorizer\n```\n\nDefine the following environment variables,\n\n```yaml\nprovider:\n  environment:\n    JWT_AUTH_ISSUERS: A space or comma separated, case sensitive list of acceptable issuers\n    GAME_STAGE: 'live' or 'test'\n\n    # Optional\n    JWT_AUTH_ALGORITHMS: Defaults to 'RS256, RS384, RS512'\n    JWT_AUTH_CLOCK_TOLERANCE: 30\n    AWS_SECRET_VALUE_TTL: e.g. '10 min', '20s' etc\n```\n\nIn your existing functions, do\n\n```yaml\nfunction:\n  app:\n    handler: existing_handler.app\n    events:\n      - http:\n          path: \"/path\"\n          method: get\n          # This is the important bit!:\n          authorizer:\n            name: jwt-authorizer\n            resultTtlInSeconds: 60\n            identitySource: method.request.header.Authorization\n            identityValidationExpression: '^Bearer [-0-9a-zA-Z.+/=_]*$'\n```\n\n\n# Advanced usage\n\n`createJwtAuthorizer` is fully customizable. All arguments are optional.\n\n```js\nconst createJwtAuthorizer = require('@goodgamestudios/aws-jwt-authorizer/create')\n\nmodule.exports = createJwtAuthorizer({\n  algorithms: 'RS256', // string or array of strings\n  issuer: ['myIssuer', 'myOtherIssuer'], // string or array of strings\n  clockTolerance: 60,\n  getToken(event) {…},\n  getPublicKey(event, decodedToken) {…},\n  shouldAllow(event, verifiedToken) {…}\n})\n```\n\n+ `getToken(event)` - get the JWT based on `event`\n+ `getPublicKey(event, decodedToken)` - get the public key based on `event` and `decodedToken`. This key will be used to verify the token’s signature.\n+ `shouldAllow(event, verifiedToken)` - return `true` if access to the requested resource should be allowed, based on the `event` and `verifiedToken`\n\n---\n\n[JWT algorithms]: https://tools.ietf.org/html/rfc7518#section-3\n[JWT verify]: https://github.com/auth0/node-jsonwebtoken#jwtverifytoken-secretorpublickey-options-callback\n[`ms`]: https://www.npmjs.com/package/ms\n","readmeFilename":"README.md"}