@gbapis/auth
v3.1.5
Published
Authorization module for quicksuite ms
Downloads
11
Keywords
Readme
Getting started
Initialization
await GbAuthorization.initialize({
storageType: 'mongo',
connection: 'contection_string',
aud: 'client_id',
alias: 'application_alias',
allowedRegions: ['US', '*'],
mapAnonUsersTo: 'Users',
});
Note: k8s-deploy add clientid
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