kernelidentity

package
v4.2.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package kernelidentity serves the KernelIdentity contract: the kernel side of the identity module. Identity owns accounts and credentials; the kernel owns subscribers (v2_user rows and their entitlements), keeps the identity columns of v2_user as a versioned read projection, and enforces revocations. Only the official identity package, whose signed release declares kernel.identity.v1, may call it.

Index

Constants

View Source
const UnusableLegacyPassword = model.UnusableLegacyPassword

UnusableLegacyPassword is stored in v2_user.password for accounts whose credentials live in identity. It never matches a password.

Variables

This section is empty.

Functions

func AuthorityState

func AuthorityState(db *gorm.DB) (string, error)

AuthorityState returns the identity authority state; no row means the kernel still owns logins.

Types

type Authorizer

type Authorizer interface {
	AuthorizeIdentity(ctx context.Context, host packagebridge.HostIdentity) error
}

Authorizer admits a calling host to KernelIdentity.

type IdentitySettings

type IdentitySettings struct {
	Registration          RegistrationSettings `json:"registration"`
	LoginRateLimit        RateLimitSettings    `json:"login_rate_limit"`
	RegisterRateLimit     RateLimitSettings    `json:"register_rate_limit"`
	AdminMFA              map[string]any       `json:"admin_mfa"`
	TokenLifetimeSeconds  int                  `json:"token_lifetime_seconds"`
	LegacyTokenIssuer     string               `json:"legacy_token_issuer"`
	AuthorityState        string               `json:"authority_state"`
	SettingsSchemaVersion int                  `json:"settings_schema_version"`
}

IdentitySettings is the settings_json document of GetIdentitySettings.

type RateLimitSettings

type RateLimitSettings struct {
	Enabled        bool `json:"enabled"`
	MaxAttempts    int  `json:"max_attempts"`
	WindowSeconds  int  `json:"window_seconds"`
	LockoutSeconds int  `json:"lockout_seconds"`
}

RateLimitSettings mirrors one login or registration rate limit.

type RegistrationSettings

type RegistrationSettings struct {
	Enabled             bool     `json:"enabled"`
	RequireInvite       bool     `json:"require_invite"`
	AllowedEmailDomains []string `json:"allowed_email_domains"`
	BlockedEmailDomains []string `json:"blocked_email_domains"`
}

RegistrationSettings mirrors the kernel's registration policy.

type Server

type Server struct {
	DB         *gorm.DB
	Authorizer Authorizer
	// Config returns the current configuration (settings, token lifetime).
	Config func() *config.Config
}

Server holds what every host's KernelIdentity calls share.

func (*Server) For

For returns the KernelIdentity server that host reaches; it has the shape of packagebridge.KernelIdentityProvider.

Jump to

Keyboard shortcuts

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