appsessionconfig

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package appsessionconfig defines per-app session configuration overrides. When set, these override the global engine SessionConfig for a specific app. Fields are pointers so nil means "inherit from the global/environment config".

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("appsessionconfig: not found")

ErrNotFound is returned when no per-app session config exists for the given app.

Functions

This section is empty.

Types

type Config

type Config struct {
	ID    id.AppSessionConfigID `json:"id"`
	AppID id.AppID              `json:"app_id"`

	// Token behavior overrides (nil = inherit from global).
	TokenTTLSeconds        *int  `json:"token_ttl_seconds,omitempty"`
	RefreshTokenTTLSeconds *int  `json:"refresh_token_ttl_seconds,omitempty"`
	MaxActiveSessions      *int  `json:"max_active_sessions,omitempty"`
	RotateRefreshToken     *bool `json:"rotate_refresh_token,omitempty"`

	// TokenExchangeTTLSeconds caps tokens minted by the RFC 8693 token
	// exchange grant for this app.
	TokenExchangeTTLSeconds *int `json:"token_exchange_ttl_seconds,omitempty"`

	// Session binding overrides (nil = inherit from global).
	BindToIP     *bool `json:"bind_to_ip,omitempty"`
	BindToDevice *bool `json:"bind_to_device,omitempty"`

	// Token format: "opaque" (default) or "jwt". Empty = inherit.
	TokenFormat string `json:"token_format,omitempty"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Config holds per-app session configuration overrides.

func (*Config) ApplyTo

func (c *Config) ApplyTo(base *account.SessionConfig)

ApplyTo applies this per-app config on top of a base account.SessionConfig. Only non-nil fields override the base values.

type Store

type Store interface {
	// GetAppSessionConfig returns the session config override for an app.
	// Returns ErrNotFound if no override is set for this app.
	GetAppSessionConfig(ctx context.Context, appID id.AppID) (*Config, error)

	// SetAppSessionConfig creates or updates the session config for an app.
	SetAppSessionConfig(ctx context.Context, cfg *Config) error

	// DeleteAppSessionConfig removes the per-app session config override.
	DeleteAppSessionConfig(ctx context.Context, appID id.AppID) error
}

Store is the persistence interface for per-app session configuration.

Jump to

Keyboard shortcuts

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