token

package
v0.0.0-...-0c36166 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUsernameRequired = errors.New("username required")

Functions

func Expire

func Expire() error

func ParseKey

func ParseKey(key map[string]interface{}) (interface{}, error)

func SetStatefulFilename

func SetStatefulFilename(filename string)

Types

type JWT

type JWT jwt.Token

func (*JWT) Check

func (token *JWT) Check(host, group string, username *string) (string, []string, error)

type Stateful

type Stateful struct {
	Token       string     `json:"token"`
	Group       string     `json:"group"`
	Username    *string    `json:"username,omitempty"`
	Permissions []string   `json:"permissions"`
	Expires     *time.Time `json:"expires"`
	NotBefore   *time.Time `json:"not-before,omitempty"`
	IssuedAt    *time.Time `json:"issuedAt,omitempty"`
	IssuedBy    *string    `json:"issuedBy,omitempty"`
}

A stateful token

func Add

func Add(token *Stateful) (*Stateful, error)

func Extend

func Extend(group, token string, expires time.Time) (*Stateful, error)

func List

func List(group string) ([]*Stateful, error)

func (*Stateful) Check

func (token *Stateful) Check(host, group string, username *string) (string, []string, error)

func (*Stateful) Clone

func (token *Stateful) Clone() *Stateful

type Token

type Token interface {
	Check(host, group string, username *string) (string, []string, error)
}

func Parse

func Parse(token string, keys []map[string]interface{}) (Token, error)

Jump to

Keyboard shortcuts

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