users

package
v0.0.0-...-13d6dd4 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const TOKENLIFE = 30 * time.Minute

TOKENLIFE the lifetime of proxy tokens we create

View Source
const TOKENREFRESH = 10 * time.Minute

TOKENREFRESH how long before expiry a token can be refreshed

Variables

API api client object

View Source
var OperationMode = ""

OperationMode the mode of operation

View Source
var ResourceType = ""

ResourceType the type of resource to search for

View Source
var SATokens map[string]string = make(map[string]string)

SATokens a cache of service account tokens for the user name

Functions

func CheckKey

func CheckKey(name string, key ssh.PublicKey) bool

CheckKey checks an ssh public key for name against the api objects public key

func GetGroups

func GetGroups(name string)

GetGroups queries the API for a group list and adds a slice of strings as a list of groups to the user.

func GetNameFromToken

func GetNameFromToken(token string) string

GetNameFromToken returns a username for an unexpired token otherwise it returns ""

func GetSAToken

func GetSAToken(name string) string

GetSAToken returns an auth token for a user

func GetToken

func GetToken(name string) string

GetToken returns the current token for a username updating the token if required.

func WriteAPIToken

func WriteAPIToken(name string) string

WriteAPIToken returns an API token json object from a username

Types

type APIToken

type APIToken struct {
	APIVersion string            `json:"apiVersion"`
	Kind       string            `json:"kind"`
	Status     map[string]string `json:"status"`
}

APIToken structured format for JSON api token

type Token

type Token struct {
	Value  string
	Expire time.Time
}

Token local representation of user token with expire time

type User

type User struct {
	Username string
	Groups   *[]string
	Token    Token
	OldToken Token
}

User local user record, containing the username and tokens

func GetUser

func GetUser(name string) (user User)

GetUser returns a user object associated with a user

Jump to

Keyboard shortcuts

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