configuration

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 14 Imported by: ? modules, 0 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 (
	AuthMethodBasic         = "client_secret_basic"
	AuthMethodPost          = "client_secret_post"
	AuthMethodNone          = "none"
	AuthMethodPrivateKeyJWT = "private_key_jwt"
)

Supported client authentication methods (mirrors the oidc.AuthMethod* values).

Variables

View Source
var (
	ErrDiscoveryFailed = errors.New("no configuration directory found")
)

Functions

func DefaultDirectory

func DefaultDirectory() (string, error)

Types

type ClientConfig

type ClientConfig struct {
	Name                      string              `yaml:"name"`
	ClientID                  string              `yaml:"client_id"`
	AccessTokenType           string              `yaml:"access_token_type"`                       // bearer or jwt.
	ApplicationType           string              `yaml:"application_type"`                        // web, native, or service.
	AuthMethod                string              `yaml:"auth_method"`                             // client_secret_basic,client_secret_post,none,private_key_jwt
	ClockSkew                 time.Duration       `yaml:"clock_skew,omitempty"`                    // time in duration format
	IDTokenLifetime           time.Duration       `yaml:"id_token_lifetime,omitempty"`             // time in duration format
	IDTokenOmitUserInfoClaims bool                `yaml:"id_token_omit_userinfo_claims,omitempty"` // true to omit profile, email, phone, address scopes from ID tokens
	GrantTypes                []string            `yaml:"grant_types"`                             // authorization_code,implicit,password,client_credentials,refresh_token etc
	RedirectURIs              []string            `yaml:"redirect_uris"`
	PostLogoutRedirectURIs    []string            `yaml:"post_logout_redirect_uris,omitempty"`
	ResponseTypes             []string            `yaml:"response_types"`
	ClientSecret              string              `yaml:"-"` // ignore when marshalling
	CustomScopes              map[string][]string `yaml:"custom_scopes,omitempty"`
}

func (*ClientConfig) IsPublic added in v0.2.0

func (c *ClientConfig) IsPublic() bool

IsPublic reports whether the client is a public client (auth_method: none), which authenticates the authorization code exchange using PKCE rather than a client secret.

func (*ClientConfig) RequiresClientSecret added in v0.2.0

func (c *ClientConfig) RequiresClientSecret() bool

RequiresClientSecret reports whether the configured authentication method relies on a shared client secret. Only client_secret_basic and client_secret_post use a secret; none (PKCE) and private_key_jwt do not.

func (*ClientConfig) ResolvedAuthMethod added in v0.2.0

func (c *ClientConfig) ResolvedAuthMethod() string

ResolvedAuthMethod returns the effective authentication method for the client. An empty value defaults to "none", which enables a public client using PKCE and therefore requires no client secret. This makes it safe to commit client configuration to source control without storing any secrets.

type ConfigurationManager

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

func NewConfigurationManager

func NewConfigurationManager(dir string) (*ConfigurationManager, error)

func Resolve

func Resolve(path string) (*ConfigurationManager, error)

func (*ConfigurationManager) Close

func (w *ConfigurationManager) Close()

func (*ConfigurationManager) GetConfigurationFilePath

func (r *ConfigurationManager) GetConfigurationFilePath() string

func (*ConfigurationManager) GetStateDatabasePath

func (r *ConfigurationManager) GetStateDatabasePath() string

func (*ConfigurationManager) IsInitialized

func (r *ConfigurationManager) IsInitialized() (bool, error)

func (*ConfigurationManager) LoadConfiguration

func (r *ConfigurationManager) LoadConfiguration() (*ServerConfig, error)

func (*ConfigurationManager) OnServerChanged

func (r *ConfigurationManager) OnServerChanged(changed func(x *ServerConfig))

OnServerChanged registers changed to be called with each reloaded configuration. Callbacks run one at a time, in registration order and in the order the changes were made, on the watcher's goroutine: they must not block.

func (*ConfigurationManager) SaveConfiguration

func (r *ConfigurationManager) SaveConfiguration(config ServerConfig) error

type HostConfig

type HostConfig struct {
	Port      int    `yaml:"port"`
	KeyPhrase string `yaml:"keyphrase"`
}

type SCIMConfig added in v0.3.0

type SCIMConfig struct {
	Endpoint    string `yaml:"endpoint"`               // base URL of the target SCIM service, e.g. https://host/scim/v2
	BearerToken string `yaml:"bearer_token,omitempty"` // optional; the IDPZERO_SCIM_TOKEN env var takes precedence
}

SCIMConfig configures outbound SCIM 2.0 provisioning, where idpzero acts as a SCIM client and pushes its configured users to an external SCIM service.

type ServerConfig

type ServerConfig struct {
	Server  HostConfig      `yaml:"server"`
	SCIM    *SCIMConfig     `yaml:"scim,omitempty"`
	Clients []*ClientConfig `yaml:"clients"`
	Users   []*User         `yaml:"users"`
}

ServerConfig is a struct that holds the server configuration and is generally stored in source control for shared use.

type User

type User struct {
	Subject      string     `yaml:"subject"`
	LoginDisplay string     `yaml:"login_display"`
	Claims       UserClaims `yaml:"claims"`
}

type UserClaims

type UserClaims struct {
	Email             *string                `yaml:"email,omitempty"`
	EmailVerified     *bool                  `yaml:"email_verified,omitempty"`
	Phone             *string                `yaml:"phone,omitempty"`
	PhoneVerified     *bool                  `yaml:"phone_verified,omitempty"`
	Name              *string                `yaml:"name,omitempty"`
	PreferredUsername *string                `yaml:"preferred_username,omitempty"`
	Nickname          *string                `yaml:"nickname,omitempty"`
	GivenName         *string                `yaml:"given_name,omitempty"`
	MiddleName        *string                `yaml:"middle_name,omitempty"`
	FamilyName        *string                `yaml:"family_name,omitempty"`
	UpdatedAt         *time.Time             `yaml:"updated_at,omitempty"`
	Custom            map[string]interface{} `yaml:"custom,omitempty"`
}

Jump to

Keyboard shortcuts

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