0.3.1 • Published 3 months ago

@byu-oit/windrunner-authorization-gro v0.3.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 months ago

@byu-oit/windrunner-authorization-gro

Authorize requests by checking if the caller is in the specified GRO group

Note To use this package you will need to install and register the @byu-oit/fastify-jwt plugin

Usage

import Fastify from 'fastify'
import { ByuLogger } from '@byu-oit/logger'
import ByuJwtProvider from '@byu-oit/fastify-jwt'
import { GroAuthorizationProvider } from '@byu-oit/windrunner-authorization-gro'

/** Define options */
const prefix = '/example/v1'
const groupId = 'example'

/** Server setup */
const fastify = Fastify({ logger: ByuLogger() })

fastify.regsiter(ByuJwtProvider, {prefix, issuer: process.env.BYU_OIT_ISSUER, development: process.env.NODE_ENV !== 'production' })

fastify.register(GroAuthorizationProvider, { prefix, groupId })

fastify.get(prefix, async (request, reply) => {
  reply.code(200).send('I find your lack of faith disturbing')
})

await fastify.listen({ port: 3000 }).catch(err => {
  console.error(err)
  process.exit(1)
})
0.3.1

3 months ago

0.3.0

5 months ago

0.2.1

7 months ago

0.2.3

7 months ago

0.2.2

7 months ago

0.2.0

12 months ago

0.1.0

12 months ago