token

package
v1.41.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator interface {
	Generate(*Payload) (string, error)
}

Generator generates tokens

func NewGenerator

func NewGenerator(issuer string, key *rsa.PrivateKey, lifetime time.Duration) Generator

NewGenerator returns a new Generator

type Operation

type Operation string

Operation is the type of the token

const (
	// OperationClone is tye of token for cloning a PVC
	OperationClone Operation = "Clone"

	// OperationUpload is the type of token for uploading to a PVC
	OperationUpload Operation = "Upload"
)

type Payload

type Payload struct {
	Operation Operation                   `json:"opertation,omitempty"`
	Name      string                      `json:"name,omitempty"`
	Namespace string                      `json:"namespace,omitempty"`
	Resource  metav1.GroupVersionResource `json:"resource,omitempty"`
	Params    map[string]string           `json:"params,omitempty"`
}

Payload is the data inside our token

type Validator

type Validator interface {
	Validate(string) (*Payload, error)
}

Validator validates tokens

func NewValidator

func NewValidator(issuer string, key *rsa.PublicKey, leeway time.Duration) Validator

NewValidator return a new Validator implementation

Jump to

Keyboard shortcuts

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