runtimectx

package
v0.376.0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextIdentityField        = "identity"
	ContextIsAuthenticatedField = "isAuthenticated"
	ContextNowField             = "now"
	ContextEnvField             = "env"
	ContextSecretField          = "secret"
)
View Source
const ContextTarget string = "ctx"
View Source
const (
	ExternalIssuersEnvKey string = "KEEL_EXTERNAL_ISSUERS"
)
View Source
const (
	SecretContextKey secretContextKey = "secret"
)

Variables

Functions

func GetMailClient

func GetMailClient(ctx context.Context) (mail.EmailClient, error)

func GetNow

func GetNow() time.Time

func GetOAuthConfig added in v0.372.0

func GetOAuthConfig(ctx context.Context) (*config.AuthConfig, error)

func GetPrivateKey

func GetPrivateKey(ctx context.Context) (*rsa.PrivateKey, error)

func GetRequestHeaders

func GetRequestHeaders(ctx context.Context) (map[string][]string, error)

func GetSecret

func GetSecret(ctx context.Context, secret string) (string, error)

func GetSecrets

func GetSecrets(ctx context.Context) map[string]string

func WithAuthConfig

func WithAuthConfig(ctx context.Context, config AuthConfig) context.Context

func WithEnv

func WithEnv(ctx context.Context, env KeelEnv) context.Context

func WithIssuersFromEnv

func WithIssuersFromEnv(ctx context.Context) context.Context

Backwards compatibility with the previous env var config.

func WithMailClient

func WithMailClient(ctx context.Context, client mail.EmailClient) context.Context

func WithOAuthConfig added in v0.372.0

func WithOAuthConfig(ctx context.Context, config *config.AuthConfig) context.Context

func WithPrivateKey

func WithPrivateKey(ctx context.Context, privateKey *rsa.PrivateKey) context.Context

func WithRequestHeaders

func WithRequestHeaders(ctx context.Context, headers map[string][]string) context.Context

func WithSecrets

func WithSecrets(ctx context.Context, secrets map[string]string) context.Context

Types

type AuthConfig added in v0.368.0

type AuthConfig struct {
	// If enabled, will verify tokens using any OIDC compatible issuer
	AllowAnyIssuers bool             `json:"AllowAllIssuers"`
	Issuers         []ExternalIssuer `json:"issuers"`
	Keel            *KeelAuthConfig  `json:"keel"`
}

func GetAuthConfig

func GetAuthConfig(ctx context.Context) (*AuthConfig, error)

type EnvKeyContextType

type EnvKeyContextType string

type ExternalIssuer added in v0.368.0

type ExternalIssuer struct {
	Iss      string  `json:"iss"`
	Audience *string `json:"audience"`
}

type KeelAuthConfig added in v0.368.0

type KeelAuthConfig struct {
	// Allow new identities to be created through the authenticate endpoint
	AllowCreate bool `json:"allowCreate"`
	// In seconds
	TokenDuration int `json:"tokenDuration"`
}

type KeelEnv

type KeelEnv string
const (
	// The Test environment denotes any Keel environment that isn't production or staging. So this includes the
	// runtime inside of the Keel Test Framework runner, as well as the runtime locally (e.g 'keel run' in the CLI)
	KeelEnvTest       KeelEnv = "test"
	KeelEnvProduction KeelEnv = "production"
)

func GetEnv

func GetEnv(ctx context.Context) KeelEnv

Jump to

Keyboard shortcuts

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