resonatecoop / user-api-old

Main Resonate User/Track API written in Go
GNU General Public License v3.0
13 stars 4 forks source link

Add JWT based authentication and role-based access control #4

Closed blushi closed 2 years ago

blushi commented 5 years ago

Prerequisites:

The user-api has currently no authentication/authorization implemented.

The tools to implement that are already there:

Regarding the models, there are already:

TODOs:

  1. Within services, the Server struct need to have additional data fields: an RBACService, a Securer and an AuthService:
    type AuthService interface {
    GetUser(context.Context) *model.AuthUser
    }

    Requests authorization need to be implemented in there. Please contact @blushi to discuss specifications.

Some inspiration from the Twisk project.

  1. Database migration:

    • Add Role and Tenant tables
    • Insert default roles and tenant(s)
  2. Adapt cmd/api/main.go

  3. Don't forget about tests!