auth

package
v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionManage Action = "cluster-manager"
	ActionRead   Action = "cluster-readonly"

	TokenDefaultExpireTime = 2 * time.Hour
	TokenRandomLength      = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

type BcsAuth

type BcsAuth interface {
	GetToken(header http.Header) (*Token, error)
	Allow(token *Token, action Action, resource Resource) (bool, error)
}

type Resource

type Resource struct {
	ClusterID string `json:"cluster_id"`
	Namespace string `json:"namespace"`
}

type Token

type Token struct {
	Token      string    `json:"token"`
	Username   string    `json:"username"`
	Message    string    `json:"message"`
	ExpireTime time.Time `json:"expire_time"`

	CreateTime time.Time `json:"create_time"`
	UpdateTime time.Time `json:"update_time"`
}

func (*Token) Generate

func (t *Token) Generate()

func (*Token) Sign

func (t *Token) Sign(duration time.Duration)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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