Skip to content

Commit 8602d9e

Browse files
TaykYokufstagni
andcommitted
docs (OAuth2): corrections and remarks
Co-Authored-By: fstagni <[email protected]>
1 parent 82acc91 commit 8602d9e

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

docs/source/AdministratorGuide/ServerInstallations/environment_variable_configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ BEARER_TOKEN_FILE
7373
If the environment variable is set, then its value is interpreted as a filename. The content of the specified file is used as token string (https://doi.org/10.5281/zenodo.3937438).
7474

7575
DIRAC_USE_ACCESS_TOKEN
76-
If this environment is set to ``true``, then when trying to connect to the server, access tokens obtained during authorization will be used (default=false)
76+
If this environment is set to ``true``, then when trying to connect to the server, access tokens will be used (default=false)

docs/source/DeveloperGuide/OAuth2Authorization/index.rst

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ OAuth 2.0 framework
2020
*******************
2121

2222
The OAuth 2.0 authorization framework is a protocol that allows a user to grant a third-party web site or application access to the user's protected resources, without necessarily revealing their long-term credentials or even their identity.
23-
There are already many articles to familiarize yourself with this framefork, for example `Auth0 Docs <https://auth0.com/docs/authorization/protocols/protocol-oauth2>`_ or `RFCs <https://oauth.net/>`_
23+
There are already many articles to familiarize yourself with this framework, for example `Auth0 Docs <https://auth0.com/docs/authorization/protocols/protocol-oauth2>`_ or `RFCs <https://oauth.net/>`_
2424

2525
The following diagram shows the main OAuth 2.0 roles in DIRAC.
2626

2727
.. image:: /_static/Systems/FS/OAuth2/OAuth2Roles.png
2828
:alt: OAuth 2.0 roles in DIRAC.
2929

30-
A feature of DIRAC is the ability to perform user tasks asynchronously on behalf of the user, ie using his access token or proxy certificate.
30+
A feature of DIRAC is the ability to perform user tasks asynchronously on behalf of the user, i.e. using their access token or proxy certificate.
3131

3232
.. image:: /_static/Systems/FS/OAuth2/DIRACComponentsInteractionRoles.png
3333
:alt: OAuth 2.0 roles in context of the DIRAC components interation.
3434

3535
As shown in the figure, DIRAC server components, such as service or agent, may have sufficient privileges to request a user access token (or proxy). Upon receiving it, the component can access the protected resource on behalf of the user.
3636

37-
.. warning:: The OAuth 2.0 scheme does not involve the use of X509 certificates, but since their using is a necessity in the DIRAC, then scheme will be slightly expanded:
37+
.. warning:: The OAuth 2.0 scheme does not involve the use of X509 certificates, but since their usage is still mandatory in DIRAC, the scheme is more complicated:
3838
the protected resource request may contain the X509 proxy user certificate instead of the user access token.
3939

4040
OAuth 2.0 roles
@@ -88,7 +88,7 @@ Components
8888

8989
- :py:class:`~DIRAC.FrameworkSystem.private.authorization.grants` contains helper classes with descriptions of the flows to get and revoke an access token.
9090
- :py:class:`~DIRAC.FrameworkSystem.private.authorization.utils` contains helper classes with main OAuth2 object descriptions and helper methods.
91-
- :py:class:`~DIRAC.FrameworkSystem.private.authorization.AuthServer` inherit `authlib.oauth2.AuthorizationServer` and simulates the operation of OAuth 2 authorization server.
91+
- :py:class:`~DIRAC.FrameworkSystem.private.authorization.AuthServer` inherits from `authlib.oauth2.AuthorizationServer` and simulates the operation of OAuth 2 authorization server.
9292

9393

9494
Configuration
@@ -199,15 +199,13 @@ Using ``dirac-login my_group --use-diracas --token``:
199199

200200
User do not need to have a locally installed certificate if logging in through DIRAC AS.
201201

202-
OAuth 2.0 Device flow:
203-
1) ``dirac-login`` initializes `OAuth 2.0 Device flow` by passing DIRAC client ID to DIRAC AS.
202+
1) ``dirac-login`` initializes **OAuth 2.0 Device flow** by passing DIRAC client ID to DIRAC AS.
204203
#) DIRAC AS responds with a ``device_code``, ``user_code``, ``verification_uri``, ``verification_uri_complete``, ``expires_in`` (lifetime in seconds for device_code and user_code), and polling ``interval``.
205204
#) The command asks the user to log in using a device that has a browser(e.g.: their computer, smartphone) or if the device running ``dirac-login`` has a browser installed, a new tab with the received URL will open automatically.
206205

207206
a) The command begins polling DIRAC AS for an access token sending requests to token endpoint until either the user completes the browser flow path or the user code expires.
208207

209-
OAuth 2.0 Authorization Code flow:
210-
4) After receiving this request from the browser, DIRAC AS will initialize ``OAuth 2.0 Authorization Code`` flow with choosed IdP. If several IdPs are registered in DIRAC and it is not clear from the requested group which one to choose, DIRAC AS will ask the user to choose one.
208+
4) After receiving this request from the browser, DIRAC AS will initialize **OAuth 2.0 Authorization Code flow** with choosed IdP. If several IdPs are registered in DIRAC and it is not clear from the requested group which one to choose, DIRAC AS will ask the user to choose one.
211209
#) DIRAC AS prepare authorization URL for the corresponding IdP and redirects the user to the login and authorization prompt.
212210
#) When the user has successfully logged in, IdP redirects him back to the DIRAC AS with an authorization code.
213211
#) DIRAC AS sends this code to the IdP along with the client credentials and recieve an ID token, access token and refresh token.
@@ -218,9 +216,7 @@ OAuth 2.0 Authorization Code flow:
218216
#) If ``TokenDB`` already contains tokens for the user, then the extra tokens are revoked (just one refresh token in Token Manager for the user is enough).
219217

220218
10) DIRAC AS update authorization session status.
221-
222-
Back to OAuth 2.0 Device flow:
223-
11) Upon receipt of a request for an access token, DIRAC AS requests :py:class:`~DIRAC.FrameworkSystem.Service.TokenManagerHandler.TokenManagerHandler` to provide a fresh access token to the requested user and group.
219+
11) Here we **back to OAuth 2.0 Device flow**. Upon receipt of a request for an access token, DIRAC AS requests :py:class:`~DIRAC.FrameworkSystem.Service.TokenManagerHandler.TokenManagerHandler` to provide a fresh access token to the requested user and group.
224220

225221
a) Token Manager forms a scope that corresponds to the selected group.
226222
#) After that Token Manager makes aexchange token request to get new access and refresh tokens.
@@ -261,12 +257,12 @@ Using ``dirac-logout``:
261257
.. image:: /_static/Systems/FS/OAuth2/revokeToken.png
262258
:alt: DIRAC logout flow.
263259

264-
If it is a long session, ie with a refresh token, which allows you to update the access token and thus continue the working session, then to end the session it is necessary to revoke refresh token:
260+
If it is a long session, i.e. with a refresh token, which allows you to update the access token and thus continue the working session, then to end the session it is necessary to revoke the refresh token:
265261
1) :ref:`dirac-logout` sends a revoke request to DIRAC AS.
266262

267263
a) DIRAC AS decrypts the refresh token and reads to whom it belongs.
268264
#) DIRAC AS makes a revoke request to the appropriate IdP.
269-
#) DIRAC AS remove record about this refresh token in ``AuthDB`` database.
265+
#) DIRAC AS removes the record about this refresh token from the ``AuthDB`` database.
270266

271267
2) Delete the token file.
272268

0 commit comments

Comments
 (0)