Documentation related to reauthentication - #217
Conversation
New devapi/reauthentication page: - architecture: ReAuthManager, ReAuthStrategyInterface, InPlaceReAuthStrategy, native strategies and their priorities, request flow and session keys - how to protect a page or an action: itemTypeRequiresReauthentication(), check()/checkGlobal()/checkReAuthenticationOrRedirect(), the $reauth_needed by-reference flag, AJAX endpoints, massive actions - how a plugin provides a strategy: registerStrategy(), in-place strategy, remote (out-of-band) strategy overriding getVerifyUrl(), prompt template - development and testing: GLPI_DISABLE_REAUTH, --group reauth, ReAuthTrait, Playwright/Cypress helpers Cross-references added from acl, controllers, massiveactions, plugins/objects and plugins/controllers pages.
New plugins/reauthentication page holding what a plugin developer needs: registerStrategy(), in-place strategy, prompt template, remote (out-of-band) strategy and its verify endpoint, security considerations, examples. devapi/reauthentication keeps the architecture and how to protect a page, and now only points to the plugins page for the strategy recipe.
| .. code-block:: php | ||
|
|
||
| <?php | ||
|
|
There was a problem hiding this comment.
Maybe add use statements?
| use Glpi\Controller\AbstractController; | |
| use Glpi\Exception\Http\AccessDeniedHttpException; | |
| use Glpi\Security\ReAuth\ReAuthManager; | |
| use Symfony\Component\HttpFoundation\Response; | |
| use Symfony\Component\Routing\Attribute\Route; | |
| A plugin can contribute its own verification method — typically an OAuth/SSO plugin verifying | ||
| the identity through the identity provider. Registered strategies are merged with the native | ||
| ones and take part in the same priority-based selection: ``ReAuthManager::registerStrategy()`` | ||
| is where it starts. | ||
|
|
||
| A plugin supplies only the *how* of verifying the identity. It cannot change the window | ||
| duration, nor which itemtypes are sensitive. | ||
|
|
||
| See :doc:`/plugins/reauthentication` for the whole recipe: registering the strategy, | ||
| implementing an in-place one, providing the prompt template, and delegating the verification to | ||
| an external service. |
There was a problem hiding this comment.
The "how a plugin registers a strategy" paragraph duplicates content already explained in plugins/reauthentication.rst:27-28 (registered strategies merged with native ones, same priority-based selection). The core page only needs the entry point and the pointer to the full recipe.
| A plugin can contribute its own verification method — typically an OAuth/SSO plugin verifying | |
| the identity through the identity provider. Registered strategies are merged with the native | |
| ones and take part in the same priority-based selection: ``ReAuthManager::registerStrategy()`` | |
| is where it starts. | |
| A plugin supplies only the *how* of verifying the identity. It cannot change the window | |
| duration, nor which itemtypes are sensitive. | |
| See :doc:`/plugins/reauthentication` for the whole recipe: registering the strategy, | |
| implementing an in-place one, providing the prompt template, and delegating the verification to | |
| an external service. | |
| A plugin can contribute its own verification method (typically an OAuth/SSO plugin verifying | |
| the identity through the identity provider) via ``ReAuthManager::registerStrategy()``. It | |
| supplies only the *how* of verifying the identity: it cannot change the window duration, nor | |
| which itemtypes are sensitive. | |
| See :doc:`/plugins/reauthentication` for the whole recipe: registering the strategy, | |
| implementing an in-place one, providing the prompt template, and delegating the verification to | |
| an external service. |
| Session keys used | ||
| +++++++++++++++++ | ||
|
|
||
| ``glpi_reauth_until`` (expiration timestamp), ``glpi_reauth_requested_url``, | ||
| ``glpi_reauth_requested_httpmethod``, ``glpi_reauth_requested_post_data``, | ||
| ``glpi_reauth_origin_url``. |
There was a problem hiding this comment.
The session keys are listed as a run-on sentence; every other multi-item enumeration in this page (native strategies, protected itemtypes) uses a table or list. A list-table would be easier to scan here too.
| Session keys used | |
| +++++++++++++++++ | |
| ``glpi_reauth_until`` (expiration timestamp), ``glpi_reauth_requested_url``, | |
| ``glpi_reauth_requested_httpmethod``, ``glpi_reauth_requested_post_data``, | |
| ``glpi_reauth_origin_url``. | |
| .. list-table:: | |
| :header-rows: 1 | |
| :widths: 40 60 | |
| * - Session key | |
| - Holds | |
| * - ``glpi_reauth_until`` | |
| - Expiration timestamp of the current window. | |
| * - ``glpi_reauth_requested_url`` | |
| - The URL to replay once verified. | |
| * - ``glpi_reauth_requested_httpmethod`` | |
| - The HTTP method of the replayed request. | |
| * - ``glpi_reauth_requested_post_data`` | |
| - The POST data of the replayed request. | |
| * - ``glpi_reauth_origin_url`` | |
| - The referer, used for the "Cancel" button. |
| When the identity is verified by an external service (OAuth/SSO, an external MFA provider…), | ||
| override ``getVerifyUrl()`` — and possibly ``getVerifyHttpMethod()`` — to point at one of your | ||
| own routes: |
There was a problem hiding this comment.
The out-of-band strategy section jumps straight to "override getVerifyUrl()" without stating that the plugin's own route then owns the whole flow (verification, opening the window, replaying the request) — unlike the in-place strategy section above it, which spells this out.
| When the identity is verified by an external service (OAuth/SSO, an external MFA provider…), | |
| override ``getVerifyUrl()`` — and possibly ``getVerifyHttpMethod()`` — to point at one of your | |
| own routes: | |
| When the identity is verified by an external service (OAuth/SSO, an external MFA provider…), the | |
| plugin's own route takes over the whole flow: verifying the identity, opening the | |
| re-authentication window, and replaying the initial request. To do this, override | |
| ``getVerifyUrl()`` — and possibly ``getVerifyHttpMethod()`` — to point at one of your own routes: |
No description provided.