usertest

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultUserName = "mock"
View Source
const MockExtraKey = "github.com/UiP9AV6Y/go-k8s-user-authz"

MockExtraKey is the key used for the MockUser extra values.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockUser

type MockUser []string

MockUser implements [user.Info] and is inteded for testing purposes. Its value is the user name.

func NewMockUser

func NewMockUser(name string) MockUser

NewMockUser returns a MockUser instance with the given name.

func (MockUser) GetExtra

func (u MockUser) GetExtra() map[string][]string

GetExtra returns a map with a single key: MockExtraKey. The value of that map entry is MockUser.GetGroups.

func (MockUser) GetGroups

func (u MockUser) GetGroups() []string

GetGroups returns an array with a single item: u

func (MockUser) GetName

func (u MockUser) GetName() string

GetName returns the first item of u, or DefaultUserName if its length is zero.

func (MockUser) GetUID

func (u MockUser) GetUID() string

GetUID returns a hash of u. It uses crc64.Checksum to generate a numeric value of the MockUser.GetName, which is then converted to a string using strconv.FormatUint.

Jump to

Keyboard shortcuts

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