Documentation
¶
Overview ¶
Package usernames holds the static rules for the usernames authn issues, so every component that names a user (authn's name guard, an access-request form, an approval controller) decides from one definition rather than a copy.
The rules here need no cluster: they are what a public form may check. Whether a name is already claimed, provisioned or granted rights by a binding is decided in-cluster, by authn's guard and at an administrator's approval, never on a public endpoint, so nobody can enumerate who exists.
Index ¶
Constants ¶
const MaxLength = kubeutil.DNS1123NameMaximumLength
MaxLength is the longest username authn issues for an identity source: Normalize cuts a longer one to this length, so it would be issued as another name.
Variables ¶
var ( ErrEmpty = errors.New("the username is empty") ErrNotIssued = errors.New("authn would issue the username in another form") ErrReserved = errors.New("the username is reserved") ErrTooLong = errors.New("the username is longer than authn issues") )
The reasons Check refuses a username.
Functions ¶
func Check ¶
Check reports whether an identity source can be given username as it is: non-empty, at most MaxLength, already in the form authn issues (so the name a person asks for is the name they sign in as, and its credential Secret is endpoints.SecretName(username)), and not reserved. It reads no cluster state. A component may add its own limits on top (a tenant namespace named after the user, say).
func Normalize ¶
Normalize is the username authn issues for an identity source's name: it makes the name DNS-1123 compatible (kubeutil.MakeDNS1123Compatible), as the OAuth and OIDC logins do with preferred_username.
func ReservedNames ¶
func ReservedNames() []string
ReservedNames returns the exact usernames that are reserved.
func ReservedPrefixes ¶
func ReservedPrefixes() []string
ReservedPrefixes returns the prefixes that reserve every username they start.
Types ¶
This section is empty.