ssosettings

package
v11.1.4-modfix Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errNotFoundBase.Errorf("not found")

	ErrNotConfigurable = errNotFoundBase.Errorf("not configurable")

	ErrBaseInvalidOAuthConfig = errutil.ValidationFailed("sso.invalidOauthConfig")

	ErrInvalidOAuthConfig = func(msg string) error {
		base := ErrBaseInvalidOAuthConfig.Errorf("OAuth settings are invalid")
		base.PublicMessage = msg
		return base
	}

	ErrInvalidProvider = errutil.ValidationFailed("sso.invalidProvider", errutil.WithPublicMessage("Provider is invalid"))
	ErrInvalidSettings = errutil.ValidationFailed("sso.settings", errutil.WithPublicMessage("Settings field is invalid"))
	ErrEmptyClientId   = errutil.ValidationFailed("sso.emptyClientId", errutil.WithPublicMessage("ClientId cannot be empty"))
)

Functions

This section is empty.

Types

type FallbackStrategy

type FallbackStrategy interface {
	IsMatch(provider string) bool
	// TODO: check if GetProviderConfig can return an error
	GetProviderConfig(ctx context.Context, provider string) (map[string]any, error)
}

FallbackStrategy is an interface that can be implemented to allow a provider to load settings from a different source than the database. This is useful for providers that are not configured in the database, but instead are configured using the config file and/or environment variables. Used mostly for backwards compatibility.

type Reloadable

type Reloadable interface {
	Reload(ctx context.Context, settings models.SSOSettings) error
	Validate(ctx context.Context, settings models.SSOSettings, oldSettings models.SSOSettings, requester identity.Requester) error
}

Reloadable is an interface that can be implemented by a provider to allow it to be validated and reloaded

type Service

type Service interface {
	// List returns all SSO settings from DB and config files
	List(ctx context.Context) ([]*models.SSOSettings, error)
	// ListWithRedactedSecrets returns all SSO settings from DB and config files with secret values redacted
	ListWithRedactedSecrets(ctx context.Context) ([]*models.SSOSettings, error)
	// GetForProvider returns the SSO settings for a given provider (DB or config file)
	GetForProvider(ctx context.Context, provider string) (*models.SSOSettings, error)
	// GetForProviderWithRedactedSecrets returns the SSO settings for a given provider (DB or config file) with secret values redacted
	GetForProviderWithRedactedSecrets(ctx context.Context, provider string) (*models.SSOSettings, error)
	// Upsert creates or updates the SSO settings for a given provider
	Upsert(ctx context.Context, settings *models.SSOSettings, requester identity.Requester) error
	// Delete deletes the SSO settings for a given provider (soft delete)
	Delete(ctx context.Context, provider string) error
	// Patch updates the specified SSO settings (key-value pairs) for a given provider
	Patch(ctx context.Context, provider string, data map[string]any) error
	// RegisterReloadable registers a reloadable for a given provider
	RegisterReloadable(provider string, reloadable Reloadable)
	// Reload reloads the settings for a given provider
	Reload(ctx context.Context, provider string)
}

Service is a SSO settings service

type Store

type Store interface {
	Get(ctx context.Context, provider string) (*models.SSOSettings, error)
	List(ctx context.Context) ([]*models.SSOSettings, error)
	Upsert(ctx context.Context, settings *models.SSOSettings) error
	Delete(ctx context.Context, provider string) error
}

Store is a SSO settings store

type ValidateFunc

type ValidateFunc[T any] func(input *T, requester identity.Requester) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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