Documentation ¶
Index ¶
- Variables
- func IsClaimError(err error) bool
- func IsLookupError(err error) bool
- func NewClaimError(user *userapi.User, identity *userapi.Identity) error
- func NewIdentityUserMapper(identities identityregistry.Registry, users userregistry.Registry, ...) (authapi.UserIdentityMapper, error)
- func NewLookupError(info authapi.UserIdentityInfo, err error) error
- type MappingMethodType
- type NoopGroupMapper
- type StrategyAdd
- type StrategyClaim
- type StrategyGenerate
- type UserForNewIdentityGetter
- func NewStrategyAdd(user userregistry.Registry, initializer user.Initializer) UserForNewIdentityGetter
- func NewStrategyClaim(user userregistry.Registry, initializer user.Initializer) UserForNewIdentityGetter
- func NewStrategyGenerate(user userregistry.Registry, initializer user.Initializer) UserForNewIdentityGetter
- type UserNameGenerator
- type UserToGroupMapper
Constants ¶
This section is empty.
Variables ¶
var ( // MaxGenerateAttempts limits how many times we try to find an available username for a new identity MaxGenerateAttempts = 100 // DefaultGenerator attempts to use the base name first, then "base2", "base3", ... DefaultGenerator = UserNameGenerator(func(base string, sequence int) string { if sequence == 0 { return base } return fmt.Sprintf("%s%d", base, sequence+1) }) )
Functions ¶
func IsClaimError ¶ added in v1.0.7
func IsLookupError ¶ added in v1.1.3
func NewClaimError ¶ added in v1.0.7
func NewIdentityUserMapper ¶ added in v1.0.7
func NewIdentityUserMapper(identities identityregistry.Registry, users userregistry.Registry, method MappingMethodType) (authapi.UserIdentityMapper, error)
NewIdentityUserMapper returns a UserIdentityMapper that does the following: 1. Returns an existing user if the identity exists and is associated with an existing user 2. Returns an error if the identity exists and is not associated with a user (or is associated with a missing user) 3. Handles new identities according to the requested method
func NewLookupError ¶ added in v1.1.3
func NewLookupError(info authapi.UserIdentityInfo, err error) error
Types ¶
type MappingMethodType ¶ added in v1.0.7
type MappingMethodType string
const ( // MappingMethodLookup does not provision a new identity or user, it only allows identities already associated with users MappingMethodLookup MappingMethodType = "lookup" // MappingMethodClaim associates a new identity with a user with the identity's preferred username // if no other identities are already associated with the user MappingMethodClaim MappingMethodType = "claim" // MappingMethodAdd associates a new identity with a user with the identity's preferred username, // creating the user if needed, and adding to any existing identities associated with the user MappingMethodAdd MappingMethodType = "add" // MappingMethodGenerate finds an available username for a new identity, based on its preferred username // If a user with the preferred username already exists, a unique username is generated MappingMethodGenerate MappingMethodType = "generate" )
type NoopGroupMapper ¶ added in v1.0.5
type NoopGroupMapper struct{}
type StrategyAdd ¶ added in v1.0.7
type StrategyAdd struct {
// contains filtered or unexported fields
}
StrategyAdd associates a new identity with a user with the identity's preferred username, adding to any existing identities associated with the user
func (*StrategyAdd) UserForNewIdentity ¶ added in v1.0.7
func (s *StrategyAdd) UserForNewIdentity(ctx apirequest.Context, preferredUserName string, identity *userapi.Identity) (*userapi.User, error)
type StrategyClaim ¶ added in v1.0.7
type StrategyClaim struct {
// contains filtered or unexported fields
}
StrategyClaim associates a new identity with a user with the identity's preferred username if no other identities are already associated with the user
func (*StrategyClaim) UserForNewIdentity ¶ added in v1.0.7
func (s *StrategyClaim) UserForNewIdentity(ctx apirequest.Context, preferredUserName string, identity *userapi.Identity) (*userapi.User, error)
type StrategyGenerate ¶ added in v1.0.7
type StrategyGenerate struct {
// contains filtered or unexported fields
}
StrategyGenerate finds an available username for a new identity, based on its preferred username If a user with the preferred username already exists, a unique username is generated
func (*StrategyGenerate) UserForNewIdentity ¶ added in v1.0.7
func (s *StrategyGenerate) UserForNewIdentity(ctx apirequest.Context, preferredUserName string, identity *userapi.Identity) (*userapi.User, error)
type UserForNewIdentityGetter ¶ added in v1.0.7
type UserForNewIdentityGetter interface { // UserForNewIdentity returns a persisted User object for the given Identity, creating it if needed UserForNewIdentity(ctx apirequest.Context, preferredUserName string, identity *userapi.Identity) (*userapi.User, error) }
UserForNewIdentityGetter is responsible for creating or locating the persisted User for the given Identity. The preferredUserName is available to the strategies
func NewStrategyAdd ¶ added in v1.0.7
func NewStrategyAdd(user userregistry.Registry, initializer user.Initializer) UserForNewIdentityGetter
func NewStrategyClaim ¶ added in v1.0.7
func NewStrategyClaim(user userregistry.Registry, initializer user.Initializer) UserForNewIdentityGetter
func NewStrategyGenerate ¶ added in v1.0.7
func NewStrategyGenerate(user userregistry.Registry, initializer user.Initializer) UserForNewIdentityGetter
type UserNameGenerator ¶ added in v0.4.2
UserNameGenerator returns a username