Skip to content

Documentation related to reauthentication - #217

Open
SebSept wants to merge 2 commits into
glpi-project:masterfrom
SebSept:sudo_doc
Open

Documentation related to reauthentication#217
SebSept wants to merge 2 commits into
glpi-project:masterfrom
SebSept:sudo_doc

Conversation

@SebSept

@SebSept SebSept commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

SebSept added 2 commits July 30, 2026 16:42
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.
@SebSept
SebSept requested review from Rom1-B and froozeify July 30, 2026 14:45
@Rom1-B
Rom1-B requested a review from stonebuzz July 31, 2026 10:04
.. code-block:: php

<?php

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add use statements?

Suggested change
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;

Comment on lines +365 to +375
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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

Comment on lines +134 to +139
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``.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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.

Comment on lines +167 to +169
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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants