token

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Subject

type Subject string
const (
	User Subject = "user"
	API  Subject = "api"
)

type Token

type Token struct {
	SubKind   Subject    `json:"sub_kind"`
	Sub       string     `json:"sub"`
	ProjectID uint       `json:"project_id"`
	IBy       uint       `json:"iby"`
	IAt       *time.Time `json:"iat"`
}

func GetTokenForAPI

func GetTokenForAPI(userID, projID uint) (*Token, error)

func GetTokenForUser

func GetTokenForUser(userID uint) (*Token, error)

func GetTokenFromEncoded

func GetTokenFromEncoded(tokenString string, conf *TokenGeneratorConf) (*Token, error)

func (*Token) EncodeToken

func (t *Token) EncodeToken(conf *TokenGeneratorConf) (string, error)

type TokenGeneratorConf

type TokenGeneratorConf struct {
	TokenSecret string
}

Jump to

Keyboard shortcuts

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