quicksuite-gb-authorization
v1.0.5
Published
Authorization module for quicksuite ms
Downloads
1
Readme
Getting started
Initialization
await GbAuthorization.initialize({
storageType: 'mongo',
connection: 'contection_string',
aud: 'client_id',
alias: 'application_alias',
allowedRegions: ['US', '*'],
mapAnonUsersTo: 'Users'
})
Create users
await GbAuthorization.addUser(
{ name: 'admin', preferredMail: '[email protected]', roles: ['rol1', 'rol2'], aud: 'client_id' })
Authorize by user region
app.use(GbAuthorization.autorizeRegion())
Authorize endpoint by role
router.get('/', GbAuthorization.authorize('Users'), (req: Request, res: Response) => {
...
})
Access to auth User
req.authUser
Quicksuite
Orchestrator
utils/entity/service.api.ts
app/server.ts