auth

package
v2.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 19 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 auth

Index

Constants

View Source
const (
	Authenticate  = "authenticate"
	Session       = "session"
	BeginLogin    = "begin_login"
	CompleteLogin = "complete_login"
)
View Source
const (
	Actor = "auth"
)

Variables

This section is empty.

Functions

func CallbackURL

func CallbackURL(appURL string) string

func Register

func Register(db *gorm.DB) error

func RegisterActor

func RegisterActor(
	conf config.Auth,
	callbackURL string,
	host *local.Host,
	provider *oidc.Provider,
) error

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func (*Auth) Invoke

func (a *Auth) Invoke(ctx context.Context, method string, data actor.Envelope) (any, error)

type AuthenticateResult

type AuthenticateResult struct {
	Subject   string    `json:"subject"`
	Email     string    `json:"email"`
	Name      string    `json:"name"`
	Groups    []string  `json:"groups"`
	ExpiresAt time.Time `json:"expires_at"`
}

AuthenticateResult is safe to return to callers. In particular, it does not expose the issuer's access, refresh, or ID tokens.

type CompleteLoginRequest

type CompleteLoginRequest struct {
	Code  string
	State string
}

type LoginResponse

type LoginResponse struct {
	RedirectURL string
}

type LoginTransaction

type LoginTransaction struct {
	State     string
	Verifier  string
	Nonce     string
	ExpiresAt time.Time
}

LoginTransaction is persisted only until the OIDC callback is completed. Its verifier and nonce must never be sent to the browser.

type OIDCResponse

type OIDCResponse struct {
	AccessToken  string
	TokenType    string
	RefreshToken string
	IDToken      string
	Scope        string
	ExpiresAt    time.Time

	Subject string
	Email   string
	Name    string
	Groups  []string
}

OIDCResponse is the already-validated response received from an OIDC issuer. The HTTP callback is responsible for exchanging the authorization code and verifying the ID token before it invokes this actor.

type Token

type Token struct {
	database.BaseModel

	Name string `json:"name"`
	Hash string `json:"-" gorm:"uniqueIndex:idx_tokens_hash"`
}

type TokenRepository

type TokenRepository struct {
	// contains filtered or unexported fields
}

func NewRepo

func NewRepo(db *gorm.DB) *TokenRepository

func (*TokenRepository) Create

func (r *TokenRepository) Create(ctx context.Context, name string) (string, Token, error)

func (*TokenRepository) Delete

func (r *TokenRepository) Delete(ctx context.Context, id uuid.UUID) error

func (*TokenRepository) List

func (r *TokenRepository) List(ctx context.Context) ([]Token, error)

func (*TokenRepository) Validate

func (r *TokenRepository) Validate(ctx context.Context, token string) error

Jump to

Keyboard shortcuts

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