auth

package
v0.0.0-...-7428172 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrActionNotAllowed = errors.New("action not allowed")
View Source
var ErrClaimsNotFound = errors.New("claims not found")

Functions

func Authorize

func Authorize(claims Claims, permission string) error

func GenerateToken

func GenerateToken(claims Claims) (string, error)

func SetClaims

func SetClaims(ctx context.Context, claims Claims) context.Context

Types

type Claims

type Claims struct {
	jwt.RegisteredClaims
	Permissions []string
}

func GetClaims

func GetClaims(ctx context.Context) (Claims, error)

func ValidateToken

func ValidateToken(tkn string) (Claims, error)

Jump to

Keyboard shortcuts

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