Code-4-Community / breaktime-backend

2 stars 0 forks source link

Authentication: Role-based access #14

Closed izzyconner closed 1 year ago

izzyconner commented 1 year ago

As a developer, I want to limit access to certain endpoints of our API based on a user's role.

There are currently three roles defined:

There should be an example on the existing backend controllers to test and refer to.

Conditions of satisfaction:

izzyconner commented 1 year ago

Reference thread:

https://stackoverflow.com/questions/41828359/how-do-i-access-the-group-for-a-cognito-user-account https://docs.nestjs.com/security/authorization

izzyconner commented 1 year ago

Sample output from the user payload:

{ sub: xxxx, 'cognito:groups': [ 'breaktime-management-role' ], .... username: 'izzyconner' }