Reputation: 647
I want to design some "central authentication and authorization service" and I know that there is already a couple. My concerns are not about the standards. In the following lines, I'll try to explain it.
I have created two Django client apps that have their own authentication and authorization mechanics. The two applications have different designs thus different permissions and roles. But the users are identical.
Now I have to create a third application through which the two former applications have to do authentication and that is OK (using for example OAuth). But the third application is also responsible for authorization, i.e. the roles, permissions (including numerous object-level permissions) are stored by and managed in the third application.
The questions are:
How can I implement the third application so that it can support non-specific, free-style permissions?
How can I store those permissions?
How should I transfer the permissions to the client applications?
How can I query for some permissions?
Should I store all permissions in the third application and query for them each time when I the user asks for some resource, or should I save them locally and update them at some points?
I have taken a look at OpenID Connect, SAML, XACML and others. SAML and XACML look promising, But I still confused and the above questions remain unanswered.
I am aware that this question covers a wide area, but having some resources for starting and some example projects will be of great help.
Regards.
Upvotes: 1
Views: 1032
Reputation: 449
A possible solution would be like the following:
How can I implement the third application so that it can support non-specific, free-style permissions? Using a JWT Token that includes the user's permissions as scopes.
How can I store those permissions?
How should I transfer the permissions to the client applications? Your client applications can validate/read the scopes included in the JWT token on each API request
How can I query for some permissions? Not sure what this means, I can interpret 2 different things:
read
access and email
access (but not the write
access), and the user can authenticate and only approve read
and email
access. In this case, the Authorization Server (Github) would generate a JWT that only includes scopes for read
and email
even though the user has other permissions available.Should I store all permissions in the third application and query for them each time when I the user asks for some resource, or should I save them locally and update them at some points?
The permissions for each user can be stored in the third application, and the client applications just trust the scopes included in the JWT. Since the access_token should be short lived (for example it expires in 1 hour), changes on the user's permission level can be handled by renewing the access_token.
Upvotes: 4