Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultDirectory() (string, error)
- type ClientConfig
- type ConfigurationManager
- func (w *ConfigurationManager) Close()
- func (r *ConfigurationManager) GetConfigurationFilePath() string
- func (r *ConfigurationManager) GetStateDatabasePath() string
- func (r *ConfigurationManager) IsInitialized() (bool, error)
- func (r *ConfigurationManager) LoadConfiguration() (*ServerConfig, error)
- func (r *ConfigurationManager) OnServerChanged(changed func(x *ServerConfig))
- func (r *ConfigurationManager) SaveConfiguration(config ServerConfig) error
- type HostConfig
- type SCIMConfig
- type ServerConfig
- type User
- type UserClaims
Constants ¶
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 ¶
var (
ErrDiscoveryFailed = errors.New("no configuration directory found")
)
Functions ¶
func DefaultDirectory ¶
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 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"`
}