{"_id":"@aaavang/azure-functions-auth","name":"@aaavang/azure-functions-auth","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.5":{"name":"@aaavang/azure-functions-auth","version":"1.0.5","description":"a middleware library for securing Azure functions using OAuth2/JWT","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"test":"jest","build":"tsc","format":"prettier --write \"src/**/*.ts\"","lint":"tslint -p tsconfig.json","prepare":"husky install"},"repository":{"type":"git","url":"git+ssh://git@github.com/Optum/azure-functions-auth.git"},"keywords":[],"author":{"name":"aaavang","email":"alexander.aavang@optum.com","url":"https://github.com/aaavang"},"license":"Apache-2.0","licenses":[{"type":"Apache-2.0","url":"https://www.apache.org/licenses/LICENSE-2.0"}],"devDependencies":{"@types/jest":"^26.0.23","@types/node":"^15.6.1","@types/node-jose":"^1.1.10","husky":"^6.0.0","jest":"^27.0.1","jest-mock-extended":"^1.0.15","prettier":"^2.3.0","ts-jest":"^27.0.1","tslint":"^6.1.3","tslint-config-prettier":"^1.18.0","typescript":"^4.3.2"},"dependencies":{"@azure/functions":"^1.2.3","applicationinsights":"^2.2.0","jose":"^4.1.4","node-jose":"^2.1.1"},"gitHead":"f390d348cd6f87e1fa1e10213951d3cfa0dd3625","bugs":{"url":"https://github.com/Optum/azure-functions-auth/issues"},"homepage":"https://github.com/Optum/azure-functions-auth#readme","_id":"@aaavang/azure-functions-auth@1.0.5","_nodeVersion":"17.7.2","_npmVersion":"8.5.2","dist":{"integrity":"sha512-hJESOqLN5Z42vK0y0kvqlma5yBKeuvIQM94eO+fVHl9bMkzNs4Rdi/BrsYx9BnN8uJxidfG+8Kv++eUGAVCO5Q==","shasum":"d2ecffe359eb1e2f3bac8d13c3706c4c28ee4deb","tarball":"https://registry.npmjs.org/@aaavang/azure-functions-auth/-/azure-functions-auth-1.0.5.tgz","fileCount":18,"unpackedSize":34186,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBWBrGyFhS5td92LXjD1YpfDNbONvPEVX7dK3wYjR7rFAiBR1Tj06Fo9kJ86MluAsX3JSz+5hIwBh7DZdqjHBpjf/A=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi/5ApACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqUNQ/8Cr9qTEDxRi12VTDBSTeIVxH55T1ym8ZgX90Y2Zbw0oIwoNB4\r\n2dip6BjIvC/A05IOVLMr0eNKscxVRV4eRBrXvOXoAQLA4xcx9NWOzMaWQwYt\r\n/Icc/eoyRH0FUtPUJlp8DG/SIlaFKgJZ7zxbG9+5mQeNlOF/IGskyzyiMBg7\r\nJNfFaqIHyXOHZHA92pUjrPhBGkUgpzEfW/7WWYzWREyPqoCpyMTLVWTbgExv\r\nQ3w00mHCDdbNi2vr1n+Gg9s3GtuXkgujYiyZa87qyLdZg4Ji1QCOZOihsYrC\r\nFxCvUVfaQdyVv3/sA9BDTrULfsSFBrQsf7l8BK1UGB4GwPsnJ1OPIv2W0VAK\r\nZc3xk92Q78K3WH4wGQ9DnBpG07uXC42SZiFJ+i97jOu8dTY3Dsk4GYcipcet\r\nO4d7eCz43ym1+/2dcBIS9ZTlqrISUng14kv77CD06p7x7MqrsNI3FuLIwT9c\r\nkopPiCnkj7PoLSg3f31XUS/UfdXvD2ft71NsWb9Rps6EdDOpRTSaiBhuwAM7\r\njWhLBfuA9FfVw6GUearR6z5wdJlPxJgm+SIzvsdNCVfNXlz37I3h/dXQFBqm\r\nOvMGM7TlhzYeo2/5ku1vd4StZGHnk9zax8TM18B8HtCrtvvuibK2xHmjciBg\r\nLgRGpniiOFf4h7bYraqraEAFt58q/9H7Cj8=\r\n=lbyI\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"alex.aavang","email":"alex.aavang@gmail.com"},"directories":{},"maintainers":[{"name":"alex.aavang","email":"alex.aavang@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/azure-functions-auth_1.0.5_1660915753003_0.584129141481228"},"_hasShrinkwrap":false}},"time":{"created":"2022-08-19T13:29:12.889Z","1.0.5":"2022-08-19T13:29:13.199Z","modified":"2022-08-19T13:29:13.371Z"},"maintainers":[{"name":"alex.aavang","email":"alex.aavang@gmail.com"}],"description":"a middleware library for securing Azure functions using OAuth2/JWT","homepage":"https://github.com/Optum/azure-functions-auth#readme","keywords":[],"repository":{"type":"git","url":"git+ssh://git@github.com/Optum/azure-functions-auth.git"},"author":{"name":"aaavang","email":"alexander.aavang@optum.com","url":"https://github.com/aaavang"},"bugs":{"url":"https://github.com/Optum/azure-functions-auth/issues"},"license":"Apache-2.0","readme":"# azure-functions-auth\n\nAn easy way to wrap Azure Functions in automatic OAuth2 JWT authorization!\n\nThis library will wrap any javascript/typescript Azure Function implementation and automatically provide access to \nthe JwtToken that was included on the request.  If the auth requirements weren't met, 401/403 responses are \nautomatically sent back.\n\nExamples:\n# Require a JWT token with no role requirements\n\n```typescript\nimport { requireAuthorization, AuthenticatedContext } from \"@optum/azure-functions-auth\"\n\nconst httpTrigger: AzureFunction = requireAuthorization(async (context: AuthenticatedContext, req: HttpRequest): Promise<void> => {\n    context.log(\"Received request from subject\", context.jwtToken.sub)\n}, {\n    jwksEndpoint: process.env.JWKS_ENDPOINT,        // configurable based on your OAuth2 provider\n    requiredIssuer: process.env.REQUIRED_ISSUER,    // configurable based on your OAuth2 provider\n    requiredAud: process.env.REQUIRED_AUD           // the specific audiance value for your service\n})\n\nexport default httpTrigger\n```\n\n# Require a JWT token with additional role requirements\n\n```typescript\nimport { requireAuthorization, AuthenticatedContext } from \"@optum/azure-functions-auth\"\n\nconst httpTrigger: AzureFunction = requireAuthorization(async (context: AuthenticatedContext, req: HttpRequest, token: JwtToken): Promise<void> => {\n    context.log(\"Received request from subject\", context.jwtToken.sub)\n}, {\n    jwksEndpoint: process.env.JWKS_ENDPOINT,        // configurable based on your OAuth2 provider\n    requiredIssuer: process.env.REQUIRED_ISSUER,    // configurable based on your OAuth2 provider\n    requiredAud: process.env.REQUIRED_AUD,          // the specific audiance value for your service\n    requiredRole: \"MY_FUNCTION_ROLE\"                // the role guarding access to this specific function endpoint\n})\n\nexport default httpTrigger\n```\n","readmeFilename":"README.md"}