|
MediaWiki master
|
Immutable value object returned by SessionProvider. More...
Inherits Stringable.

Public Member Functions | |
| __construct ( $priority, array $data) | |
| __toString () | |
| forceHTTPS () | |
| Whether this session should only be used over HTTPS. | |
| forceUse () | |
| Force use of this SessionInfo if validation fails. | |
| getId () | |
| Return the session ID. | |
| getPriority () | |
| Return the priority. | |
| getProvider () | |
| Return the provider. | |
| getProviderMetadata () | |
| Return provider metadata. | |
| getUserInfo () | |
| Return the user. | |
| isIdSafe () | |
| Indicate whether the ID is "safe". | |
| needsRefresh () | |
| Indicate that the session metadata needs to be re-persisted. | |
| wasPersisted () | |
| Return whether the session is persisted. | |
| wasRemembered () | |
| Return whether the user was remembered. | |
Static Public Member Functions | |
| static | compare ( $a, $b) |
| Compare two SessionInfo objects by priority. | |
Public Attributes | |
| const | MAX_PRIORITY = 100 |
| Maximum allowed priority. | |
| const | MIN_PRIORITY = 1 |
| Minimum allowed priority. | |
Immutable value object returned by SessionProvider.
Holds the data necessary to construct a Session.
There are two stages of constructing a Session, which use a potentially different info object:
Definition at line 26 of file SessionInfo.php.
| MediaWiki\Session\SessionInfo::__construct | ( | $priority, | |
| array | $data ) |
| int | $priority | Session priority |
| array | $data |
|
Definition at line 105 of file SessionInfo.php.
References MediaWiki\Session\SessionInfo\forceHTTPS(), MediaWiki\Session\SessionInfo\forceUse(), MediaWiki\Session\SessionInfo\needsRefresh(), and MediaWiki\Session\SessionManager\validateSessionId().
| MediaWiki\Session\SessionInfo::__toString | ( | ) |
Definition at line 301 of file SessionInfo.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\refreshSessionInfo().
|
static |
Compare two SessionInfo objects by priority.
| SessionInfo | $a | |
| SessionInfo | $b |
Definition at line 313 of file SessionInfo.php.
|
final |
Whether this session should only be used over HTTPS.
This should be ignored if $wgForceHTTPS is true.
Definition at line 297 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionInfo\__construct(), and MediaWiki\Session\SessionBackend\__construct().
|
final |
Force use of this SessionInfo if validation fails.
The normal behavior is to discard the SessionInfo if validation against the data stored in the session store fails. If this returns true, SessionManager will instead delete the session store data so this SessionInfo may still be used. This is important for providers which use deterministic IDs and so cannot just generate a random new one.
Definition at line 236 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionInfo\__construct().
|
final |
Return the session ID.
Definition at line 195 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionBackend\__construct(), MediaWiki\Session\SessionManager\getSessionFromInfo(), and MediaWiki\Session\MultiBackendSessionStore\set().
|
final |
Return the priority.
Definition at line 244 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionBackend\__construct(), and MediaWiki\Session\JwtSessionCookieHelper\verifyJwtCookie().
|
final |
Return the provider.
Definition at line 187 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionBackend\__construct(), and MediaWiki\Session\JwtSessionCookieHelper\verifyJwtCookie().
|
final |
Return provider metadata.
Definition at line 268 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionBackend\__construct().
|
final |
Return the user.
Definition at line 252 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionBackend\__construct(), MediaWiki\Session\BotPasswordSessionProvider\refreshSessionInfo(), and MediaWiki\Session\JwtSessionCookieHelper\verifyJwtCookie().
|
final |
Indicate whether the ID is "safe".
The ID is safe in the following cases:
Definition at line 212 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionManager\getSessionFromInfo().
|
final |
Indicate that the session metadata needs to be re-persisted.
This will result in Session::save() being called.
Definition at line 221 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionInfo\__construct(), and MediaWiki\Session\SessionManager\getSessionFromInfo().
|
final |
Return whether the session is persisted.
Definition at line 260 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionBackend\__construct(), MediaWiki\Session\SessionManager\getSessionFromInfo(), and MediaWiki\Session\JwtSessionCookieHelper\verifyJwtCookie().
|
final |
Return whether the user was remembered.
For providers that can persist the user separately from the session, the human using it may not actually want that to be done. For example, a cookie-based provider can set cookies that are longer-lived than the backend session data, but on a public terminal the human likely doesn't want those cookies set.
This is false unless a non-anonymous verified user was passed to the SessionInfo constructor by the provider, and the provider didn't pass false for the 'remembered' data item.
Definition at line 287 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionBackend\__construct(), and MediaWiki\Session\SessionManager\getSessionFromInfo().
| const MediaWiki\Session\SessionInfo::MAX_PRIORITY = 100 |
Maximum allowed priority.
Definition at line 31 of file SessionInfo.php.
Referenced by MediaWiki\Session\BotPasswordSessionProvider\__construct(), MediaWiki\Session\CookieSessionProvider\__construct(), and MediaWiki\Session\BotPasswordSessionProvider\newSessionForRequest().
| const MediaWiki\Session\SessionInfo::MIN_PRIORITY = 1 |
Minimum allowed priority.
Definition at line 28 of file SessionInfo.php.
Referenced by MediaWiki\Session\SessionProvider\__construct(), MediaWiki\Session\BotPasswordSessionProvider\__construct(), and MediaWiki\Session\CookieSessionProvider\__construct().