Cookie final readonly class
Minn\Auth\Cookie · public/minn/src/Minn/Auth/Cookie.php · 92 lines
The sign-in cookies: username|expiration|token|hmac, with key = HMAC-md5(username|fragment|expiration|token, the scheme's salt) hmac = HMAC-sha256(username|expiration|token, key) and the session live in the user's session_tokens store. The engine's own sign-in reads the logged_in one; check() judges any scheme's the way wp_validate_auth_cookie reports it (probe auth-cookies).
Constants and properties
| private | readonly Minn\Db $db | Promoted from the constructor. |
| private | readonly Minn\Content\Users $users | Promoted from the constructor. |
| private | readonly Minn\Auth\Sessions $sessions | Promoted from the constructor. |
Public
| new | __construct(Minn\Db $db, Minn\Content\Users $users, Minn\Auth\Sessions $sessions)# | ||||
| method | name(): string# | The cookie name this site uses: a hash of the siteurl option. | |||
| method | mint(Minn\Content\UserRecord $user, int $expiration, string $token): string# | A sign-in cookie value for a user, expiry, and session token. | |||
| method | validate(string $value): ?Minn\Auth\Authenticated# | The session a logged_in cookie value proves, or null when any part fails. | |||
| method | check(string $username, string $expiration, string $token, string $hmac, string $scheme, int $grace = 0): array# | A cookie's parts judged under a scheme, in the reference's order: expired (past its expiration plus $grace), bad_username, bad_hash (an unknown scheme never matches), bad_session_token, else valid with its user. @return array{string, ?UserRecord} | |||
| method | fromJar(array $cookies): ?string# | The logged_in cookie from a request's cookie jar: the canonical name first, then any logged_in cookie, since tooling may send a name derived from a different host.
| |||
| static | signature(string $username, string $fragment, int $expiration, string $token, string $scheme = 'logged_in'): ?string# | A cookie's hmac under a scheme's salt, or null for a scheme with none. |
Nothing matches.