Documentation
¶
Overview ¶
Package session owns browser session data, expiry, revocation and encrypted shared persistence. It has no process configuration or authentication client.
Index ¶
Constants ¶
View Source
const CookieName = "mcp_ui_session"
View Source
const Duration = 8 * time.Hour
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
// Put stores a session until its ExpiresAt. It may also drop expired rows.
Put(ctx context.Context, sess Session, now time.Time) error
// Get returns a live session. A missing or expired session is (_, false, nil).
Get(ctx context.Context, id string, now time.Time) (Session, bool, error)
Delete(ctx context.Context, id string) error
}
Backend persists UI sessions. The default in-memory backend keeps the single-replica behavior (sessions are lost on restart); a shared backend lets several UI replicas validate the same session cookie.
type Session ¶
type Session struct {
ID string
ExpiresAt time.Time
Principal Principal
UpstreamAuthHeader string
UpstreamAPIKey string
// CSRFToken is the session-bound synchroniser token. It is handed to
// same-origin JavaScript and required back on every state-changing
// request; the browser handler owns validation in the UI's csrf.go.
CSRFToken string
}
Click to show internal directories.
Click to hide internal directories.