models

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUserPrincipleNameFromToken

func GetUserPrincipleNameFromToken(token string) (string, error)

GetUserPrincipleNameFromToken reads the upn claim value from a token The JWT signature is not validated, so ensure that the token signature is valid before using this function

Types

type Accounts

type Accounts struct {
	// contains filtered or unexported fields
}

Accounts contains accounts for accessing k8s API.

func NewAccounts

func NewAccounts(
	token string,
	impersonation Impersonation) Accounts

NewAccounts creates a new Accounts struct

func (Accounts) GetToken

func (accounts Accounts) GetToken() string

GetToken get the user token

func (Accounts) GetUserAccountUserPrincipleName

func (accounts Accounts) GetUserAccountUserPrincipleName() (string, error)

GetUserAccountUserPrincipleName get the user principle name represented in UserAccount

type Controller

type Controller interface {
	GetRoutes() Routes
}

Controller Pattern of an rest/stream controller

type DefaultController

type DefaultController struct {
}

DefaultController Default implementation

type Impersonation

type Impersonation struct {
	User   string
	Groups []string
}

Impersonation holds user and group to impersonate

func NewImpersonation

func NewImpersonation(user string, groups []string) (Impersonation, error)

NewImpersonation Constructor

func (Impersonation) PerformImpersonation

func (impersonation Impersonation) PerformImpersonation() bool

PerformImpersonation Impersonate user

type RadixHandlerFunc

type RadixHandlerFunc func(Accounts, http.ResponseWriter, *http.Request)

RadixHandlerFunc Pattern for handler functions

type Route

type Route struct {
	Path        string
	Method      string
	HandlerFunc RadixHandlerFunc
}

Route Describe route

type Routes

type Routes []Route

Routes Holder of all routes

Jump to

Keyboard shortcuts

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