bootstrap

package
v0.66.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: Apache-2.0 Imports: 33 Imported by: 4 modules, 4 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

Index

Constants

View Source
const (
	DefaultSigningKeyID   = "default"
	DefaultSigningKeyBits = 2048

	DefaultGuestIdentityManagerName = "guest"
	DefaultCookieSameSite           = http.SameSiteNoneMode
)

Defaults.

Variables

This section is empty.

Functions

func LoadCertificatesAndValidatorFromFile added in v0.57.0

func LoadCertificatesAndValidatorFromFile(fn string) (string, []*x509.Certificate, crypto.PublicKey, error)

LoadCertificatesAndValidatorFromFile loads chain of certificates and a public-key used for validation.

Supported formats are JSON-JWK and PEM

func LoadSignerFromFile

func LoadSignerFromFile(fn string) (string, crypto.Signer, error)

LoadSignerFromFile loads a private-key for signing

Supports JSON (JWK/JWS) and PEM

func LoadValidatorFromFile

func LoadValidatorFromFile(fn string) (string, crypto.PublicKey, error)

LoadValidatorFromFile loads a public-key used for validation.

Supported formats are JSON-JWK and PEM

func RegisterIdentityManager

func RegisterIdentityManager(name string, f IdentityManagerFactory) error

func WithSchemeAndHost

func WithSchemeAndHost(u, base *url.URL) *url.URL

Types

type APIType

type APIType string

API types.

const (
	APITypeKonnect APIType = "konnect"
	APITypeSignin  APIType = "signin"
)

type Bootstrap

type Bootstrap interface {
	Config() *Config
	Managers() *managers.Managers

	MakeURIPath(api APIType, subpath string) string
}

Bootstrap is a data structure to hold configuration required to start konnectd.

func Boot

func Boot(ctx context.Context, settings *Settings, cfg *config.Config) (Bootstrap, error)

Boot is the main entry point to bootstrap the service after validating the given configuration. The resulting Bootstrap struct can be used to retrieve configured identity-managers and their respective http-handlers and config.

This function should be used by consumers which want to embed this project as a library.

type Config

type Config struct {
	Config   *config.Config
	Settings *Settings

	SignInFormURI            *url.URL
	SignedOutURI             *url.URL
	AuthorizationEndpointURI *url.URL
	EndSessionEndpointURI    *url.URL

	TLSClientConfig *tls.Config

	IssuerIdentifierURI *url.URL

	IdentifierClientDisabled          bool
	IdentifierClientPath              string
	IdentifierRegistrationConf        string
	IdentifierAuthoritiesConf         string
	IdentifierScopesConf              string
	IdentifierDefaultSignInPageText   *string
	IdentifierDefaultLogoTargetURI    *string
	IdentifierDefaultUsernameHintText *string
	IdentifierUILocales               []string

	EncryptionSecret []byte
	SigningMethod    jwt.SigningMethod
	SigningKeyID     string
	Signers          map[string]crypto.Signer
	Validators       map[string]crypto.PublicKey
	Certificates     map[string][]*x509.Certificate

	AccessTokenDurationSeconds        uint64
	IDTokenDurationSeconds            uint64
	RefreshTokenDurationSeconds       uint64
	DyamicClientSecretDurationSeconds uint64

	CookieSameSite http.SameSite
}

Config is a typed application config which represents the active bootstrap configuration.

type IdentityManagerFactory

type IdentityManagerFactory func(Bootstrap) (identity.Manager, error)

type Settings

type Settings struct {
	Iss                               string
	IdentityManager                   string
	URIBasePath                       string
	SignInURI                         string
	SignedOutURI                      string
	AuthorizationEndpointURI          string
	EndsessionEndpointURI             string
	Insecure                          bool
	TrustedProxy                      []string
	AllowScope                        []string
	AllowClientGuests                 bool
	AllowDynamicClientRegistration    bool
	EncryptionSecretFile              string
	Listen                            string
	IdentifierClientDisabled          bool
	IdentifierClientPath              string
	IdentifierRegistrationConf        string
	IdentifierScopesConf              string
	IdentifierDefaultSignInPageText   string
	IdentifierDefaultLogoTargetURI    string
	IdentifierDefaultUsernameHintText string
	IdentifierUILocales               []string
	SigningKid                        string
	SigningMethod                     string
	SigningPrivateKeyFiles            []string
	ValidationKeysPath                string
	CookieBackendURI                  string
	CookieNames                       []string
	CookieSameSite                    http.SameSite
	AccessTokenDurationSeconds        uint64
	IDTokenDurationSeconds            uint64
	RefreshTokenDurationSeconds       uint64
	DyamicClientSecretDurationSeconds uint64
}

Settings is a typed application config which represents the user accessible boostrap settings params.

Directories

Path Synopsis
backends

Jump to

Keyboard shortcuts

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