I am about to write a central service for authentication AND authorization in our company, let's call it C-AAA.
This central service is holding all user credentials. It is also equipped with a web-based user interface where administrators may assign access rights for different services (i.e. web applications) to specific users. These applications should now use a standardized method to ask C-AAA whether a user should be provided access or not.
The first thought which came into my mind was to use OAuth 2.0 as this allows us to easily provide the auth interface also to third party applications, mobile apps and so on.
The process I imagine is as follows:
- A secured web application ("SecApp") is called by a user.
- SecApp checks for an existing valid session (within the application).
- If no session exists already, it calls C-AAA using a client secret and client id as OAuth suggests. Additionally, the applications sets a scope for the request, being her own name 'secapp'. If client id and secret are correct, an authentication code is returned.
- Using the auth code, the user is redirected to the login on C-AAA.
- The user provides his/her credentials to C-AAA.
- C-AAA verifies them AND checks whether the requested scope corresponds with the roles associated with the user. ("secapp.user" and "secapp.admin" might be defined as valid permissions in this case.)
- Only if both conditions are true, the user is authorized and an access token is generated.
- The access token is returned to the SecApp application.
- Information about the user's personal data and application permissions (user/admin) is fetched from the C-AAA.
- The user information is stored in a session variable within the SecApp application and access is granted according to the returned roles.
The OAuth specification does not say too much about the use of scopes. Therefore, I am asking:
Is this a legitimate use of the OAuth 2.0 standard? If not, which method would you recommend in my case? (I'd really like not to reinvent the wheel and therefore stick with standards.)
Side note: C-AAA is implemented with Symfony2, using FOSUserBundle and FOSOAuthServerBundle.
Thanks in advance for your answers!