Documentation
¶
Overview ¶
Package sessiontest checks a SessionStore against the contract every session store must keep, so a custom store proves itself with one call rather than by finding out in production which rule it broke. The core's SQL and memory stores and contrib/redis all run it.
It imports only the standard library and the core, so a store's own tests can use it whatever else they depend on.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run checks the store that open returns. open is called once per case, so every case starts empty; a store backed by a shared server should return a store with a fresh key prefix or a cleared keyspace each time.
func RunCache ¶
RunCache checks the SessionCache that open returns against the contract every cache must keep, whether it holds entries on the server (memory, Redis: Put returns "") or hands the client a copy (the sealed snapshot, the jwt plugin's signed snapshot: Put returns the value). open is called once per case. The core's caches, contrib/redis and plugin/jwt run it.
The rules: an entry comes back whole (every session and user field) for the token it was put for and no other; it is used before its expiry and never at or after it; a client copy that was changed, truncated or made up is a miss, never an error, so the request falls back to the store; a server-side entry is forgotten by Drop; a cache that implements auth.SessionCacheUserDropper forgets every entry of one user, and only that user's, on DropUser.
func RunRevocations ¶
RunRevocations checks the SessionRevocations that open returns against the contract every revocation list must keep. open is called once per case, so every case starts empty; a list on a shared server returns one with a fresh key prefix. The core's memory list and contrib/redis run it.
The rules: a revoked id is reported revoked until its instant and never at or after it, judged by the time the core passes, not a clock of the list's own; an id never revoked is not; revoking one id leaves every other alone; revoking again with a later instant extends the entry and with an earlier one never shortens it.