0.1.7 • Published 8 months ago
@byu-oit/fastify-jwt v0.1.7
@byu-oit/fastify-jwt
Provides a fastify plugin for verifying JWTs at BYU OIT
Usage
import Fastify from 'fastify'
import { ByuLogger } from '@byu-oit/logger'
import { ByuJwtProvider } from '@byu-oit/fastify-jwt'
const logger = ByuLogger()
const fastify = Fastify({ logger })
fastify.register(ByuJwtProvider, {
/** Only authenticate routes matching this prefix */
prefix: '/example/v1',
development: process.env.NODE_ENV === 'development',
/** May pass in ByuJwt options from @byu-oit/jwt */
issuer: 'https://api.byu.edu',
additionalValidations: [(jwt) => {
if(false) throw new Error('This will never happen')
}]
})
await fastify.listen({ port: 3000 }).catch(console.error)
Options
In addition to the three properties below, you can also pass in any options that are defined in BYU JWT documentation as well.
property | type | default | description |
---|---|---|---|
prefix | string | undefined | Will only authenticate routes matching this prefix. |
development | boolean | false | skips JWT verification for development purposes but will throw an error if NODE_ENV is set to production . |
basePath | string | undefined | will validate that the audience starts with the provided basePath in production. |
0.1.7-beta.1
8 months ago
0.1.7-beta.2
8 months ago
0.1.7-beta.3
8 months ago
0.1.7-beta.0
8 months ago
0.1.7
8 months ago
0.1.4
11 months ago
0.1.6
11 months ago
0.1.5
11 months ago
0.1.3
12 months ago
0.1.0-beta.3
1 year ago
0.1.0-beta.2
1 year ago
0.1.0-beta.5
1 year ago
0.1.0-beta.4
1 year ago
0.1.0-beta.1
1 year ago
0.1.0-beta.0
1 year ago
0.1.0
1 year ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0-beta.6
1 year ago
0.0.1-beta.0
1 year ago