service

package
v0.0.0-...-580b6da Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionCookieName    = "flagcel_session"
	OAuthStateCookieName = "flagcel_oauth_state"
	OAuthNonceCookieName = "flagcel_oauth_nonce"
)

Variables

This section is empty.

Functions

func IsAuthError

func IsAuthError(err error) bool

Types

type AuthConfig

type AuthConfig struct {
	OIDCIssuerURL     string
	OIDCClientID      string
	OIDCSecret        string
	OIDCRedirectURL   string
	AdminEmails       string
	BootstrapEmail    string
	BootstrapPassword string
	BootstrapName     string
	SessionSecret     string
	CookieSecure      bool
	SessionTTL        time.Duration
}

type AuthService

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

func NewAuthService

func NewAuthService(ctx context.Context, cfg AuthConfig, store *postgres.Store) (*AuthService, error)

func (*AuthService) CompleteOIDCLogin

func (s *AuthService) CompleteOIDCLogin(ctx context.Context, code, nonce string) (*core.User, error)

func (*AuthService) CookieSecure

func (s *AuthService) CookieSecure() bool

func (*AuthService) CreateAPIKey

func (s *AuthService) CreateAPIKey(ctx context.Context, name, description, environmentID string) (*CreatedAPIKey, error)

func (*AuthService) CreateSession

func (s *AuthService) CreateSession(ctx context.Context, userID string) (string, time.Time, error)

func (*AuthService) Enabled

func (s *AuthService) Enabled() bool

func (*AuthService) ListAPIKeys

func (s *AuthService) ListAPIKeys(ctx context.Context) ([]*core.APIKey, error)

func (*AuthService) LoginURL

func (s *AuthService) LoginURL(state, nonce string) (string, error)

func (*AuthService) LoginWithPassword

func (s *AuthService) LoginWithPassword(ctx context.Context, email, password string) (*core.User, error)

func (*AuthService) Mode

func (s *AuthService) Mode() string

func (*AuthService) OIDCEnabled

func (s *AuthService) OIDCEnabled() bool

func (*AuthService) PasswordEnabled

func (s *AuthService) PasswordEnabled() bool

func (*AuthService) RevokeAPIKey

func (s *AuthService) RevokeAPIKey(ctx context.Context, id string) error

func (*AuthService) RevokeSession

func (s *AuthService) RevokeSession(ctx context.Context, token string) error

func (*AuthService) SessionTTL

func (s *AuthService) SessionTTL() time.Duration

func (*AuthService) UserForSessionToken

func (s *AuthService) UserForSessionToken(ctx context.Context, token string) (*core.User, error)

func (*AuthService) ValidateAPIKey

func (s *AuthService) ValidateAPIKey(ctx context.Context, token string) (*core.APIKey, error)

type ContextService

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

func NewContextService

func NewContextService(store *postgres.Store, onContextChange ...func(string)) *ContextService

func (*ContextService) CreateContext

func (s *ContextService) CreateContext(ctx context.Context, c *core.ContextSchema) (*core.ContextSchema, error)

func (*ContextService) DeleteContext

func (s *ContextService) DeleteContext(ctx context.Context, id string) error

func (*ContextService) GetContext

func (s *ContextService) GetContext(ctx context.Context, id string) (*core.ContextSchema, error)

func (*ContextService) ListContexts

func (s *ContextService) ListContexts(ctx context.Context) ([]*core.ContextSchema, error)

func (*ContextService) UpdateContext

func (s *ContextService) UpdateContext(ctx context.Context, c *core.ContextSchema) (*core.ContextSchema, error)

type CreatedAPIKey

type CreatedAPIKey struct {
	Key   *core.APIKey
	Token string
}

type EnvironmentService

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

func NewEnvironmentService

func NewEnvironmentService(store *postgres.Store) *EnvironmentService

func (*EnvironmentService) Create

func (s *EnvironmentService) Create(ctx context.Context, env *core.Environment) error

func (*EnvironmentService) Default

func (*EnvironmentService) Delete

func (s *EnvironmentService) Delete(ctx context.Context, id string) error

func (*EnvironmentService) Get

func (*EnvironmentService) List

func (*EnvironmentService) Update

func (s *EnvironmentService) Update(ctx context.Context, env *core.Environment) error

type EvalService

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

func NewEvalService

func NewEvalService(store *postgres.Store, eng *evalcore.Engine) *EvalService

func (*EvalService) Definitions

func (s *EvalService) Definitions(ctx context.Context, environmentID string) (evalcore.Definitions, string, error)

func (*EvalService) DefinitionsETag

func (s *EvalService) DefinitionsETag() string

func (*EvalService) Evaluate

func (s *EvalService) Evaluate(ctx context.Context, environmentID, key string, user evalcore.DataContext) (core.FlagValue, error)

func (*EvalService) EvaluateAll

func (s *EvalService) EvaluateAll(ctx context.Context, environmentID string, user evalcore.DataContext) (map[string]core.FlagValue, error)

func (*EvalService) EvaluateWithTrace

func (s *EvalService) EvaluateWithTrace(ctx context.Context, environmentID, key string, user evalcore.DataContext) (evalcore.EvaluationTrace, error)

func (*EvalService) InvalidateContext

func (s *EvalService) InvalidateContext(id string)

func (*EvalService) InvalidateFlag

func (s *EvalService) InvalidateFlag(environmentID, key string)

type FlagService

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

func NewFlagService

func NewFlagService(store *postgres.Store, onFlagChange ...func(string, string)) *FlagService

func (*FlagService) CreateFlag

func (s *FlagService) CreateFlag(ctx context.Context, environmentID string, flag *core.FlagConfig) error

func (*FlagService) DeleteFlag

func (s *FlagService) DeleteFlag(context context.Context, environmentID, id string) error

func (*FlagService) GetFlag

func (s *FlagService) GetFlag(ctx context.Context, environmentID, key string) (*core.FlagConfig, error)

func (*FlagService) GetFlagHistory

func (s *FlagService) GetFlagHistory(ctx context.Context, environmentID, key string) ([]*core.AuditEntry, error)

func (*FlagService) GetFlags

func (s *FlagService) GetFlags(ctx context.Context, environmentID string) ([]*core.FlagConfig, error)

type OIDCUserInfo

type OIDCUserInfo struct {
	Subject       string `json:"sub"`
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	Nonce         string `json:"nonce"`
}

type RuleService

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

func NewRuleService

func NewRuleService(store *postgres.Store, onFlagChange ...func(string, string)) *RuleService

func (*RuleService) CreateRule

func (s *RuleService) CreateRule(ctx context.Context, environmentID, flagKey string, rule core.Rule) (*core.Rule, error)

func (*RuleService) DeleteRule

func (s *RuleService) DeleteRule(ctx context.Context, environmentID, flagKey, ruleID string) error

func (*RuleService) GetRule

func (s *RuleService) GetRule(ctx context.Context, environmentID, flagKey, ruleID string) (*core.Rule, error)

func (*RuleService) ListRules

func (s *RuleService) ListRules(ctx context.Context, environmentID, flagKey string) ([]core.Rule, error)

func (*RuleService) ReorderRules

func (s *RuleService) ReorderRules(ctx context.Context, environmentID, flagKey string, ruleIDs []string) error

func (*RuleService) UpdateRule

func (s *RuleService) UpdateRule(ctx context.Context, environmentID, flagKey string, rule core.Rule) (*core.Rule, error)

Jump to

Keyboard shortcuts

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