service

package
v0.19.921 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NuonAuthCookieName  string = "X-Nuon-Auth"
	NuonAuthSessionName string = "nuon-auth-session"
)

Cookie and session names

View Source
const (
	HeaderNuonAuthUser    = "X-Nuon-Auth-User"
	HeaderNuonAuthEmail   = "X-Nuon-Auth-Email"
	HeaderNuonAuthSuccess = "X-Nuon-Auth-Success"
	HeaderNuonAuthClaims  = "X-Nuon-Auth-Claims"
)

Response headers for validated requests

View Source
const (
	// DefaultProviderID is the ID used for the env-configured default provider.
	DefaultProviderID = "default"
)

Variables

View Source
var (
	// ErrAccountNotAuthorized is returned when a user tries to authenticate
	// but has no existing account and no pending org invite.
	ErrAccountNotAuthorized = errors.New("account not authorized: no existing account or pending invitation found")

	// ErrEmailDomainNotAllowed is returned when a user tries to authenticate
	// but their email domain is not in the allowed domains list.
	ErrEmailDomainNotAllowed = errors.New("email domain not allowed")
)

Functions

func New

func New(params Params) (*service, error)

Types

type Params

type Params struct {
	fx.In

	V          *validator.Validate
	Cfg        *internal.Config
	DB         *gorm.DB `name:"psql"`
	MW         metrics.Writer
	L          *zap.Logger
	AcctClient *account.Client
}

type ProviderOption

type ProviderOption struct {
	ID           string
	Name         string
	ProviderType string
}

ProviderOption represents a login option to display in the UI.

type SessionData

type SessionData struct {
	State        string `json:"state"`
	ProviderID   string `json:"pid,omitempty"`
	RequestedURL string `json:"url,omitempty"`
	FailCount    int    `json:"fc,omitempty"`
	CreatedAt    int64  `json:"iat"`
}

SessionData holds the OAuth flow state in a signed cookie.

type TokenInfo

type TokenInfo struct {
	AccountID string
	Email     string
	Username  string
}

TokenInfo represents the validated token information.

Jump to

Keyboard shortcuts

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