Documentation
¶
Overview ¶
Package session keeps the in-memory state that ties a logged-in user to the tokens the mock has issued, so later requests (/userinfo) can see the same user the id_token described.
Index ¶
- Constants
- type Access
- type Grant
- type Login
- type Store
- func (s *Store) Access(token string) (Access, bool)
- func (s *Store) Clear()
- func (s *Store) EndLogin(id string)
- func (s *Store) Login(id string) (Login, bool)
- func (s *Store) Profile(subject string) (map[string]any, bool)
- func (s *Store) Refresh(token string) (Grant, bool)
- func (s *Store) RememberAccess(token string, a Access)
- func (s *Store) RememberProfile(subject string, profile map[string]any)
- func (s *Store) RememberRefresh(token string, g Grant)
- func (s *Store) StartLogin(subject string, authTime time.Time) string
Constants ¶
const MaxEntries = 10000
MaxEntries bounds how many user profiles, and separately how many refresh grants, opaque access tokens and login sessions, the store keeps; the oldest inserted entry of a kind is evicted when a new one arrives at the limit.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Access ¶
Access is what the mock remembers about an opaque access token, issued when there is no audience to mint a JWT for, so /userinfo can resolve it.
type Grant ¶
type Grant struct {
Subject, ClientID, Audience, Scope, Realm string
AuthTime time.Time
Profile map[string]any
}
Grant is what the mock remembers about a refresh token it issued, so the refresh_token grant can return the same user.
type Login ¶
Login is a mock login session: who signed in and when, kept server-side behind the auth0 cookie so a later prompt=none request can answer for them.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is a mutex-guarded session registry.
func (*Store) EndLogin ¶
EndLogin forgets the login session with the given id; unknown ids are ignored.
func (*Store) RememberAccess ¶
RememberAccess stores a under the opaque access token. It is bounded by MaxEntries like refresh grants, evicting the oldest token first.
func (*Store) RememberProfile ¶
RememberProfile stores a copy of profile for subject; last write wins.
func (*Store) RememberRefresh ¶
RememberRefresh stores a copy of g under the refresh token. It is bounded by MaxEntries like profiles, evicting the oldest token first.