1

We have a monolith application and looking to decouple the authentication / authorization service.

At this stage, authorization is the simplest to start with.

The problem comes with authorizing certain type of access to resources. e.g. a user can edit only his own posts.

Given that the microservice will hold only roles/auth items and assignments to an user id, does it make sense to create the following endpoint?

POST v1/<userEmail>/authorize/<authItemName>

with data, e.g.

v1/user@company.com/authorize/Posts.UpdateOwn`

{
  post: {
     content: 'My first post'
     ...
     creator: {
        email: user@company.com
     }
  }
}

Where we would send the object's data and the user's data. That way I can have a rule that would return true if object.creatorId === userData.id however if you think about it, it seems pretty dumb... if the monolith already has the info, why not just check for the general permission Post.Edit and also checking that the user is the creator.

Is there a better approach for this?

JorgeeFG
  • 5,651
  • 12
  • 59
  • 92

0 Answers0