|
MediaWiki master
|
Public Member Functions | |
| __construct (private readonly UrlUtils $urlUtils, private readonly Config $config, protected JwtCodec $jwtCodec, private readonly SessionManager $sessionManager, private readonly string $sessionProviderType, private readonly CentralIdLookup $centralIdLookup, private readonly UserFactory $userFactory) | |
| getJwtClaimOverrides (int $expirationDuration) | |
| Helper method to make it easy for subclasses to alter claims. | |
| getJwtCookieSessionExpiration () | |
| Expiration duration for the JWT session cookie. | |
| getJwtIssuer () | |
| setJwtCookie (User $user, WebRequest $request, array $jwtCookieOptions, array $jwtClaimOverrides) | |
| Emit a JWT cookie containing the user ID, token and other information. | |
| useJwtCookie () | |
| Tells whether the provider should emit session data as a JWT cookie, alongside of (in the future, possibly instead of) the normal session cookies. | |
| verifyJwtCookie (WebRequest $request, SessionInfo &$sessionInfo, array $jwtCookieOptions, array $jwtClaimOverrides) | |
| Ensure that the JWT cookie (if it exists) matches the SessionInfo. | |
Public Attributes | |
| const | JWT_COOKIE_NAME = 'sessionJwt' |
| Name of the JWT cookie, when enabled. | |
Protected Member Functions | |
| getUserFromJwtData (array $jwtData) | |
Protected Attributes | |
| string | $jti = null |
| JWT 'jti' field. | |
Definition at line 24 of file JwtSessionCookieHelper.php.
| MediaWiki\Session\JwtSessionCookieHelper::__construct | ( | private readonly UrlUtils | $urlUtils, |
| private readonly Config | $config, | ||
| protected JwtCodec | $jwtCodec, | ||
| private readonly SessionManager | $sessionManager, | ||
| private readonly string | $sessionProviderType, | ||
| private readonly CentralIdLookup | $centralIdLookup, | ||
| private readonly UserFactory | $userFactory ) |
| UrlUtils | $urlUtils | |
| Config | $config | |
| JwtCodec | $jwtCodec | |
| SessionManager | $sessionManager | |
| string | $sessionProviderType | |
| CentralIdLookup | $centralIdLookup | |
| UserFactory | $userFactory |
Definition at line 48 of file JwtSessionCookieHelper.php.
| MediaWiki\Session\JwtSessionCookieHelper::getJwtClaimOverrides | ( | int | $expirationDuration | ) |
Helper method to make it easy for subclasses to alter claims.
| int | $expirationDuration | Session lifetime in seconds. |
Definition at line 281 of file JwtSessionCookieHelper.php.
| MediaWiki\Session\JwtSessionCookieHelper::getJwtCookieSessionExpiration | ( | ) |
Expiration duration for the JWT session cookie.
Definition at line 266 of file JwtSessionCookieHelper.php.
| MediaWiki\Session\JwtSessionCookieHelper::getJwtIssuer | ( | ) |
Definition at line 270 of file JwtSessionCookieHelper.php.
|
protected |
| JwtException |
Definition at line 97 of file JwtSessionCookieHelper.php.
| MediaWiki\Session\JwtSessionCookieHelper::setJwtCookie | ( | User | $user, |
| WebRequest | $request, | ||
| array | $jwtCookieOptions, | ||
| array | $jwtClaimOverrides ) |
Emit a JWT cookie containing the user ID, token and other information.
Definition at line 70 of file JwtSessionCookieHelper.php.
| MediaWiki\Session\JwtSessionCookieHelper::useJwtCookie | ( | ) |
Tells whether the provider should emit session data as a JWT cookie, alongside of (in the future, possibly instead of) the normal session cookies.
Definition at line 63 of file JwtSessionCookieHelper.php.
| MediaWiki\Session\JwtSessionCookieHelper::verifyJwtCookie | ( | WebRequest | $request, |
| SessionInfo & | $sessionInfo, | ||
| array | $jwtCookieOptions, | ||
| array | $jwtClaimOverrides ) |
Ensure that the JWT cookie (if it exists) matches the SessionInfo.
A missing JWT cookie is treated as a success.
If the SessionInfo has a UserInfo, verifies that the JWT cookie contains the same user. If the SessionInfo does not have a UserInfo, an unverified UserInfo will be added to it based on the JWT data (so the verification will happen in SessionManager::loadSessionInfoFromStore()).
Marks the session to be refreshed if the JWT cookie is missing (but based on the SessionInfo should be there) or is near expiry.
| JwtException | on error |
Definition at line 134 of file JwtSessionCookieHelper.php.
References MediaWiki\Session\SessionInfo\getPriority(), MediaWiki\Session\SessionInfo\getProvider(), MediaWiki\Session\SessionInfo\getUserInfo(), and MediaWiki\Session\SessionInfo\wasPersisted().
|
protected |
JWT 'jti' field.
FIXME This is an ugly hack to make the cookie set in setJwtCookie() deterministic within a given request. We don't have a mechanism to avoid writing cookies several times per request, and rely on WebResponse deduplicating cookies as long as the values are the same.
Definition at line 37 of file JwtSessionCookieHelper.php.
| const MediaWiki\Session\JwtSessionCookieHelper::JWT_COOKIE_NAME = 'sessionJwt' |
Name of the JWT cookie, when enabled.
Ignores $wgCookiePrefix.
Definition at line 29 of file JwtSessionCookieHelper.php.