Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delegate authorisation to external Auth 2.0 services

I'm working on a service that provides smart (hopefully) integration of different services supporting OAuth 2.0. The focus of our tool is on team work flow improvement, so we're combining Slack, GitHub, Asana (issue tracker), Cezanne (hr tool), etc.

We have ui and backend that work with all those tools (user is authorised to all of them, so I have required access and refresh tokens). We need to be able to hide different parts of the ui depending on person's role in a specific tool. Let's take GitHub as an example. The user can be a repository owner, contributor, company owner (for business account), etc, so those user might need different ui based on their rights.

Originally I was hesitant implementing authorisation on my own (another custom authorisation system is the last thing this world needs), I wanted to take advantage of other services' authorisation mechanisms and just create a lightweight wrapper around them. It seemed like a reasonable idea at first, but I can't figure out how to implement it and Google doesn't give valuable advice which means: 99.99% I'm trying to do something stupid, 00.01% I'm trying to do something rare/innovative.

I hoped to take advantage of OAuth 2.0 but it doesn't seem to support what we need. The closest thing is scopes but it doesn't look very relevant to our scenario.

The only idea I have for now is to create our own authorisation system and integrate other services using kind of reverse engineering. So I would request user's GitHub account details using API and apply him roles in our system appropriately: Owner for repository A, contributor for repository B, owner of company C, etc. I will have to reverse-engineer the permission for each role (i. e. repository owner can not change company name). And we would have to keep user roles for each service: so instead of typical Admin/User/Manager/etc. we will get: OwnerOfGitHubRepository (for repositoryA), ManagerOfAsanaTeam (for team B), etc.

It would be awesome if OAuth 2.0 services had an endpoint that would return the permissions available for a current user.

I'm not a security engineer, so I might be missing something obvious. So wanted to ask you guys for advice before investing into the implementation mentioned above.

like image 884
SiberianGuy Avatar asked Jan 30 '23 10:01

SiberianGuy


1 Answers

The word, "authorization", is used in two different contexts.

In one context, authorization means "who has what permissions". Solutions for this authorization is "identity management".

In the other context, authorization means "who grants what permissions to whom". Solutions for this authorization is "OAuth".

In some cases, you may have to handle these two authorizations simultaneously. See this question and this answer for details.

like image 67
Takahiko Kawasaki Avatar answered Feb 26 '23 07:02

Takahiko Kawasaki