SessionController
extends z_controller
in package
Table of Contents
- action_add() : void
- action_addWithExec() : void
- action_addWithName() : void
- action_apiKeyAdd() : void
- action_apiKeyById() : void
- Session 430 is a login, session 431 an api key. Looking one up through the other class finds nothing.
- action_apiKeyByToken() : void
- A token says nothing about its kind, so the row picks the class. This is shared through CanUseSession, so both classes resolve both kinds - which is what keeps an api key out of the login timeout when it authenticates.
- action_apiKeyByUser() : void
- User 430 owns one login, two api keys and one revoked api key. Each class lists its own kind only.
- action_apiKeyClearName() : void
- Api key 437 is seeded with a name; passing null is the way back to an unnamed key.
- action_apiKeyManage() : void
- Api key 434 starts out unnamed and expiring. Both are changed through the object and read back from the refreshed object and a second lookup.
- action_apiKeyPermanentExpiry() : void
- Api key 435 was created in the year 2000 without an extension, so only the exemption from expiring keeps it alive. Dropping it expires it again.
- action_byToken() : void
- action_byTokenInactive() : void
- action_byTokenNotFound() : void
- action_byUser() : void
- action_currentSession() : void
- The session behind the current cookie, so cypress can read back what a login path stored on it.
- action_extendAfterExpire() : void
- After an expired session (415) has been used once (which auto-invalidates it), this action tries to call setExtensionTime on it.
- action_extendHashed() : void
- action_extendSession() : void
- action_getters() : void
- action_invalidate() : void
- action_invalidateForAuth() : void
- Invalidates session 412 (token 0410a...) so the subsequent whoami request with that cookie is rejected.
- action_legacyTokenDeprecated() : void
- action_loginSessionNames() : void
- The names of every session of user 436, who is logged in for real by the login-naming test, so cypress can see what loginAs() stored.
- action_refresh() : void
- action_removeUserForAuth() : void
- Removes user 414 while its session 416 (token 0414a...) stays active, so the subsequent whoami request with that cookie must be rejected.
- action_sessionIpLast() : void
- Session 439 is seeded with a stale ip_last, which the authenticated request that carries its cookie has to correct.
- action_sessionOrigin() : void
- A session records why it was created and where from, both taken at creation time. User 439 has no seeded session, so this one is fresh.
- action_sessionPermanent() : void
- Session 438 is an ordinary login created in the year 2000, so it is expired until it is exempted from expiring.
- action_setExpiresAt() : void
- Session 442 is an ordinary login from the year 2000, so it expires by its age until an expiry is fixed on it, and again once that is dropped.
- action_setExtensionTime() : void
- action_tokenAtRest() : void
- action_tokenIndex() : void
- Every authenticated request looks its session up by token, so the lookup has to hit a unique index instead of scanning the table.
- action_tokenKnown() : void
- action_whoami() : void
- Returns the authentication state of the current HTTP request.
- className() : string|null
- echoSessions() : void
- getExpiry() : array<string|int, mixed>
- getNameAndExpiry() : array<string|int, mixed>
- getSession() : array<string|int, mixed>
- getSessions() : array<string|int, mixed>
- sessionIds() : array<string|int, mixed>
Methods
action_add()
public
action_add(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_addWithExec()
public
action_addWithExec(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_addWithName()
public
action_addWithName(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_apiKeyAdd()
public
action_apiKeyAdd(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_apiKeyById()
Session 430 is a login, session 431 an api key. Looking one up through the other class finds nothing.
public
action_apiKeyById(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_apiKeyByToken()
A token says nothing about its kind, so the row picks the class. This is shared through CanUseSession, so both classes resolve both kinds - which is what keeps an api key out of the login timeout when it authenticates.
public
action_apiKeyByToken(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_apiKeyByUser()
User 430 owns one login, two api keys and one revoked api key. Each class lists its own kind only.
public
action_apiKeyByUser(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_apiKeyClearName()
Api key 437 is seeded with a name; passing null is the way back to an unnamed key.
public
action_apiKeyClearName(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_apiKeyManage()
Api key 434 starts out unnamed and expiring. Both are changed through the object and read back from the refreshed object and a second lookup.
public
action_apiKeyManage(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_apiKeyPermanentExpiry()
Api key 435 was created in the year 2000 without an extension, so only the exemption from expiring keeps it alive. Dropping it expires it again.
public
action_apiKeyPermanentExpiry(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_byToken()
public
action_byToken(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_byTokenInactive()
public
action_byTokenInactive(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_byTokenNotFound()
public
action_byTokenNotFound(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_byUser()
public
action_byUser(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_currentSession()
The session behind the current cookie, so cypress can read back what a login path stored on it.
public
action_currentSession(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_extendAfterExpire()
After an expired session (415) has been used once (which auto-invalidates it), this action tries to call setExtensionTime on it.
public
action_extendAfterExpire(Request $req, Response $res) : void
Because validateCookie already set active=0, Session::byId() returns null (it queries WHERE active=1). So the extension cannot happen and the session stays dead. The test then re-sends the cookie and expects isLoggedIn=false.
Parameters
- $req : Request
- $res : Response
Return values
void —action_extendHashed()
public
action_extendHashed(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_extendSession()
public
action_extendSession(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_getters()
public
action_getters(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_invalidate()
public
action_invalidate(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_invalidateForAuth()
Invalidates session 412 (token 0410a...) so the subsequent whoami request with that cookie is rejected.
public
action_invalidateForAuth(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_legacyTokenDeprecated()
public
action_legacyTokenDeprecated(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_loginSessionNames()
The names of every session of user 436, who is logged in for real by the login-naming test, so cypress can see what loginAs() stored.
public
action_loginSessionNames(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_refresh()
public
action_refresh(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_removeUserForAuth()
Removes user 414 while its session 416 (token 0414a...) stays active, so the subsequent whoami request with that cookie must be rejected.
public
action_removeUserForAuth(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_sessionIpLast()
Session 439 is seeded with a stale ip_last, which the authenticated request that carries its cookie has to correct.
public
action_sessionIpLast(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_sessionOrigin()
A session records why it was created and where from, both taken at creation time. User 439 has no seeded session, so this one is fresh.
public
action_sessionOrigin(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_sessionPermanent()
Session 438 is an ordinary login created in the year 2000, so it is expired until it is exempted from expiring.
public
action_sessionPermanent(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_setExpiresAt()
Session 442 is an ordinary login from the year 2000, so it expires by its age until an expiry is fixed on it, and again once that is dropped.
public
action_setExpiresAt(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_setExtensionTime()
public
action_setExtensionTime(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_tokenAtRest()
public
action_tokenAtRest(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_tokenIndex()
Every authenticated request looks its session up by token, so the lookup has to hit a unique index instead of scanning the table.
public
action_tokenIndex(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_tokenKnown()
public
action_tokenKnown(Request $req, Response $res) : void
Parameters
- $req : Request
- $res : Response
Return values
void —action_whoami()
Returns the authentication state of the current HTTP request.
public
action_whoami(Request $req, Response $res) : void
Cypress sets the z_login_token cookie before calling this endpoint.
Parameters
- $req : Request
- $res : Response
Return values
void —className()
private
className(Session|APIKey|null $session) : string|null
Parameters
Return values
string|null —echoSessions()
private
echoSessions(array<string|int, mixed> $sessions) : void
Parameters
- $sessions : array<string|int, mixed>
Return values
void —getExpiry()
private
getExpiry(Session|APIKey $session) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —getNameAndExpiry()
private
getNameAndExpiry(Session|APIKey $session) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —getSession()
private
getSession(Session|APIKey|null $session) : array<string|int, mixed>
Parameters
Return values
array<string|int, mixed> —getSessions()
private
getSessions(array<string|int, mixed> $sessions) : array<string|int, mixed>
Parameters
- $sessions : array<string|int, mixed>
Return values
array<string|int, mixed> —sessionIds()
private
sessionIds(array<string|int, mixed> $sessions) : array<string|int, mixed>
Parameters
- $sessions : array<string|int, mixed>