MediaWiki master
MediaWiki\Hook\GetSessionJwtDataHook Interface Reference

This is a hook handler interface, see docs/Hooks.md. More...

Inherited by MediaWiki\HookContainer\HookRunner.

Public Member Functions

 onGetSessionJwtData (?UserIdentity $user, array &$jwtData)
 Called when a JWT session token is created, can modify the information stored within.
 

Detailed Description

This is a hook handler interface, see docs/Hooks.md.

Use the hook name "GetSessionJwtData" to register handlers implementing this interface.

Stability: stable
to implement

Definition at line 15 of file GetSessionJwtDataHook.php.

Member Function Documentation

◆ onGetSessionJwtData()

MediaWiki\Hook\GetSessionJwtDataHook::onGetSessionJwtData ( ?UserIdentity $user,
array & $jwtData )

Called when a JWT session token is created, can modify the information stored within.

JWT tokens are used to authenticate requests for some session types. The details depend on the session type.

Might be called both when the JWT is created (for mutable sessions during SessionProvider::persistSession(); for immutable sessions, where session tokens are created out-of-band, in the business logic of some API / special page / etc), and when the JWT is verified (during SessionProvider::provideSessionInfo() and maybe refreshSessionInfo()).

Note that session verification happens before the user is autocreated, so you should not rely on $session->getUser()->isAnon() and similar.

Parameters
UserIdentity | null$userThe user who is the subject of the claim. Guaranteed to not be an IP user. Null if the session is anonymous.
array&$jwtDataA set of JWT claims that the hook can alter or expand. Claim values are JSON-compatible data structures (ie. scalar values or array structures where the leafs are scalar values).
Returns
void This hook must not abort, it must return no value
Since
1.45
See also
SessionManager::getJwtData()

Implemented in MediaWiki\HookContainer\HookRunner.


The documentation for this interface was generated from the following file: