usernames

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

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

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

View Source
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

func Check(username string) error

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

func Normalize(name string) string

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 Reserved

func Reserved(username string) bool

Reserved reports whether an identity source may not take 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.

Jump to

Keyboard shortcuts

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