sessionstore

package
v0.51.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sessionstore owns PostgreSQL session rows. Public consumers use typed session handles, never these heterogeneous infrastructure models.

Index

Constants

This section is empty.

Variables

View Source
var Entries = orm.Define("foundry_sessions", func(b orm.Builder[Entry], m *Entry) EntryTable {
	table := orm.TableOf(b, &m.ID)
	field0 := table.Key()
	field1 := orm.TextOf(b, &m.Scope)
	field2 := orm.TextOf(b, &m.SubjectKey)
	field3 := orm.TextOf(b, &m.SecretHash)
	field4 := orm.NumberOf(b, &m.Assurance)
	field5 := orm.ColumnOf(b, &m.Remember)
	field6 := orm.ColumnOf(b, &m.Sliding)
	field7 := orm.NumberOf(b, &m.IdleNanos)
	field8 := orm.TimeOf(b, &m.CreatedAt)
	field9 := orm.TimeOf(b, &m.LastSeenAt)
	field10 := orm.TimeOf(b, &m.IdleExpiresAt)
	field11 := orm.TimeOf(b, &m.ExpiresAt)
	field12 := orm.NullableTextOf(b, &m.ClientIP)
	field13 := orm.NullableTextOf(b, &m.UserAgent)
	field14 := orm.NullableTimeOf(b, &m.ConfirmedAt)
	field15 := orm.NullableTextOf(b, &m.ImpersonatorIdentity)
	field16 := orm.NullableTextOf(b, &m.ImpersonatorGuard)
	field17 := orm.NullableColumnOf(b, &m.ImpersonatorSession)
	return EntryTable{
		Table:                table,
		ID:                   field0,
		Scope:                field1,
		SubjectKey:           field2,
		SecretHash:           field3,
		Assurance:            field4,
		Remember:             field5,
		Sliding:              field6,
		IdleNanos:            field7,
		CreatedAt:            field8,
		LastSeenAt:           field9,
		IdleExpiresAt:        field10,
		ExpiresAt:            field11,
		ClientIP:             field12,
		UserAgent:            field13,
		ConfirmedAt:          field14,
		ImpersonatorIdentity: field15,
		ImpersonatorGuard:    field16,
		ImpersonatorSession:  field17,
	}
}, orm.ModelFingerprint("1dd0c2758c7bd260e06a64ef31271bafe2d94a574d68e7859ba8ab0fab3766de"))

Entries is the foundry_sessions table.

View Source
var Subjects = orm.Define("foundry_session_subjects", func(b orm.Builder[Subject], m *Subject) SubjectTable {
	table := orm.TableOf(b, &m.Key)
	field1 := orm.TextOf(b, &m.Scope)
	field2 := orm.JSONOf(b, &m.Identity)
	return SubjectTable{
		Table:    table,
		Scope:    field1,
		Identity: field2,
	}
}, orm.ModelFingerprint("e1fd8e443cb9969f9f8eb87ecec01660b8b51946d3619acbf326b1540965cb1b"))

Subjects is the foundry_session_subjects table.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	// Table provides Entry queries and writes. Example: Entries.Query().Limit(10).
	//
	// ID binds the persisted Entry.ID column.
	// Example: orm.Eq(Entries.ID, id).
	ID model.ID[Entry] `foundry:"member=ID"`
	// Scope binds the persisted Entry.Scope column.
	// Example: orm.Set(Entries.Scope, scope).
	Scope string
	// SubjectKey binds the persisted Entry.SubjectKey column.
	// Example: orm.Set(Entries.SubjectKey, subjectKey).
	SubjectKey string
	// SecretHash binds the persisted Entry.SecretHash column.
	// Example: orm.Set(Entries.SecretHash, secretHash).
	SecretHash string
	// Assurance binds the persisted Entry.Assurance column.
	// Example: orm.Set(Entries.Assurance, assurance).
	Assurance uint8
	// Remember binds the persisted Entry.Remember column.
	// Example: orm.Set(Entries.Remember, remember).
	Remember bool `foundry:"role=column"`
	// Sliding binds the persisted Entry.Sliding column.
	// Example: orm.Set(Entries.Sliding, sliding).
	Sliding bool `foundry:"role=column"`
	// IdleNanos binds the persisted Entry.IdleNanos column.
	// Example: orm.Set(Entries.IdleNanos, idleNanos).
	IdleNanos int64
	// CreatedAt binds the caller-supplied creation time; the ORM does not automatically populate or refresh it.
	// Example: orm.Set(Entries.CreatedAt, createdAt).
	CreatedAt temporal.DateTime `foundry:"role=time"`
	// LastSeenAt binds the persisted Entry.LastSeenAt column.
	// Example: orm.Set(Entries.LastSeenAt, lastSeenAt).
	LastSeenAt temporal.DateTime
	// IdleExpiresAt binds the persisted Entry.IdleExpiresAt column.
	// Example: orm.Set(Entries.IdleExpiresAt, idleExpiresAt).
	IdleExpiresAt temporal.DateTime
	// ExpiresAt binds the persisted Entry.ExpiresAt column.
	// Example: orm.Set(Entries.ExpiresAt, expiresAt).
	ExpiresAt temporal.DateTime
	// ClientIP and UserAgent are display-only device metadata from issuance.
	//
	// ClientIP binds the persisted Entry.ClientIP column.
	// Example: orm.SetNull(Entries.ClientIP).
	ClientIP value.Nullable[string]
	// UserAgent binds the persisted Entry.UserAgent column.
	// Example: orm.SetNull(Entries.UserAgent).
	UserAgent value.Nullable[string]
	// ConfirmedAt is the last password confirmation within this session.
	//
	// ConfirmedAt binds the persisted Entry.ConfirmedAt column.
	// Example: orm.SetNull(Entries.ConfirmedAt).
	ConfirmedAt value.Nullable[temporal.DateTime]
	// ImpersonatorIdentity (identity JSON), ImpersonatorGuard and
	// ImpersonatorSession mark an impersonation session with its original actor.
	//
	// ImpersonatorIdentity binds the persisted Entry.ImpersonatorIdentity column.
	// Example: orm.SetNull(Entries.ImpersonatorIdentity).
	ImpersonatorIdentity value.Nullable[string]
	// ImpersonatorGuard binds the persisted Entry.ImpersonatorGuard column.
	// Example: orm.SetNull(Entries.ImpersonatorGuard).
	ImpersonatorGuard value.Nullable[string]
	// ImpersonatorSession binds the persisted Entry.ImpersonatorSession column.
	// Example: orm.SetNull(Entries.ImpersonatorSession).
	ImpersonatorSession value.Nullable[model.ID[Entry]] `foundry:"role=column"`
}

Entry contains only a hash of the random session secret. Rotation changes the hash while retaining the public session identifier and absolute deadline.

func (Entry) Format

func (Entry) Format(s fmt.State, _ rune)

type EntryTable

type EntryTable struct {
	//
	// Table provides Entry queries and writes. Example: Entries.Query().Limit(10).
	//
	// ID binds the persisted Entry.ID column.
	// Example: orm.Eq(Entries.ID, id).
	//
	// See [Entry.ID].
	orm.Table[Entry, model.ID[Entry]]
	//
	// Table provides Entry queries and writes. Example: Entries.Query().Limit(10).
	//
	// ID binds the persisted Entry.ID column.
	// Example: orm.Eq(Entries.ID, id).
	//
	// See [Entry.ID].
	ID orm.Key[Entry, model.ID[Entry]]
	//
	// Scope binds the persisted Entry.Scope column.
	// Example: orm.Set(Entries.Scope, scope).
	//
	// See [Entry.Scope].
	Scope orm.Text[Entry, string]
	//
	// SubjectKey binds the persisted Entry.SubjectKey column.
	// Example: orm.Set(Entries.SubjectKey, subjectKey).
	//
	// See [Entry.SubjectKey].
	SubjectKey orm.Text[Entry, string]
	//
	// SecretHash binds the persisted Entry.SecretHash column.
	// Example: orm.Set(Entries.SecretHash, secretHash).
	//
	// See [Entry.SecretHash].
	SecretHash orm.Text[Entry, string]
	//
	// Assurance binds the persisted Entry.Assurance column.
	// Example: orm.Set(Entries.Assurance, assurance).
	//
	// See [Entry.Assurance].
	Assurance orm.Number[Entry, uint8]
	//
	// Remember binds the persisted Entry.Remember column.
	// Example: orm.Set(Entries.Remember, remember).
	//
	// See [Entry.Remember].
	Remember orm.Column[Entry, bool]
	//
	// Sliding binds the persisted Entry.Sliding column.
	// Example: orm.Set(Entries.Sliding, sliding).
	//
	// See [Entry.Sliding].
	Sliding orm.Column[Entry, bool]
	//
	// IdleNanos binds the persisted Entry.IdleNanos column.
	// Example: orm.Set(Entries.IdleNanos, idleNanos).
	//
	// See [Entry.IdleNanos].
	IdleNanos orm.Number[Entry, int64]
	//
	// CreatedAt binds the caller-supplied creation time; the ORM does not automatically populate or refresh it.
	// Example: orm.Set(Entries.CreatedAt, createdAt).
	//
	// See [Entry.CreatedAt].
	CreatedAt orm.Time[Entry, temporal.DateTime]
	//
	// LastSeenAt binds the persisted Entry.LastSeenAt column.
	// Example: orm.Set(Entries.LastSeenAt, lastSeenAt).
	//
	// See [Entry.LastSeenAt].
	LastSeenAt orm.Time[Entry, temporal.DateTime]
	//
	// IdleExpiresAt binds the persisted Entry.IdleExpiresAt column.
	// Example: orm.Set(Entries.IdleExpiresAt, idleExpiresAt).
	//
	// See [Entry.IdleExpiresAt].
	IdleExpiresAt orm.Time[Entry, temporal.DateTime]
	//
	// ExpiresAt binds the persisted Entry.ExpiresAt column.
	// Example: orm.Set(Entries.ExpiresAt, expiresAt).
	//
	// See [Entry.ExpiresAt].
	ExpiresAt orm.Time[Entry, temporal.DateTime]
	//
	// ClientIP and UserAgent are display-only device metadata from issuance.
	//
	// ClientIP binds the persisted Entry.ClientIP column.
	// Example: orm.SetNull(Entries.ClientIP).
	//
	// See [Entry.ClientIP].
	ClientIP orm.NullableText[Entry, string]
	//
	// UserAgent binds the persisted Entry.UserAgent column.
	// Example: orm.SetNull(Entries.UserAgent).
	//
	// See [Entry.UserAgent].
	UserAgent orm.NullableText[Entry, string]
	//
	// ConfirmedAt is the last password confirmation within this session.
	//
	// ConfirmedAt binds the persisted Entry.ConfirmedAt column.
	// Example: orm.SetNull(Entries.ConfirmedAt).
	//
	// See [Entry.ConfirmedAt].
	ConfirmedAt orm.NullableTime[Entry, temporal.DateTime]
	//
	// ImpersonatorIdentity (identity JSON), ImpersonatorGuard and
	// ImpersonatorSession mark an impersonation session with its original actor.
	//
	// ImpersonatorIdentity binds the persisted Entry.ImpersonatorIdentity column.
	// Example: orm.SetNull(Entries.ImpersonatorIdentity).
	//
	// See [Entry.ImpersonatorIdentity].
	ImpersonatorIdentity orm.NullableText[Entry, string]
	//
	// ImpersonatorGuard binds the persisted Entry.ImpersonatorGuard column.
	// Example: orm.SetNull(Entries.ImpersonatorGuard).
	//
	// See [Entry.ImpersonatorGuard].
	ImpersonatorGuard orm.NullableText[Entry, string]
	//
	// ImpersonatorSession binds the persisted Entry.ImpersonatorSession column.
	// Example: orm.SetNull(Entries.ImpersonatorSession).
	//
	// See [Entry.ImpersonatorSession].
	ImpersonatorSession orm.NullableColumn[Entry, model.ID[Entry]]
}

EntryTable binds the declared fields of Entry.

type Subject

type Subject struct {
	// Table provides Subject queries and writes. Example: Subjects.Query().Limit(10).
	Key string
	// Scope binds the persisted Subject.Scope column.
	// Example: orm.Set(Subjects.Scope, scope).
	Scope string
	// Identity binds the persisted Subject.Identity column.
	// Example: encoded, err := value.NewJSON(identity); if err == nil { _ = orm.Set(Subjects.Identity, encoded) }.
	Identity value.JSON[model.Identity]
}

Subject is the stable per-scope identity row used to serialize issue/revoke. It is not a user model and stores no roles, permissions or credentials.

func (Subject) Format

func (Subject) Format(s fmt.State, _ rune)

type SubjectTable

type SubjectTable struct {
	//
	// Table provides Subject queries and writes. Example: Subjects.Query().Limit(10).
	//
	// See [Subject.Key].
	orm.Table[Subject, string]
	//
	// Scope binds the persisted Subject.Scope column.
	// Example: orm.Set(Subjects.Scope, scope).
	//
	// See [Subject.Scope].
	Scope orm.Text[Subject, string]
	//
	// Identity binds the persisted Subject.Identity column.
	// Example: encoded, err := value.NewJSON(identity); if err == nil { _ = orm.Set(Subjects.Identity, encoded) }.
	//
	// See [Subject.Identity].
	Identity orm.JSON[Subject, model.Identity]
}

SubjectTable binds the declared fields of Subject.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL