perms

package
v0.16.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultPerms   = []auth.Permission{"public"}
	ReadPerms      = []auth.Permission{"public", "read"}
	ReadWritePerms = []auth.Permission{"public", "read", "write"}
	AllPerms       = []auth.Permission{"public", "read", "write", "admin"}
)
View Source
var AuthKey = "Authorization"

Functions

func NewTokenWithPerms

func NewTokenWithPerms(signer jwt.Signer, perms []auth.Permission) ([]byte, error)

NewTokenWithPerms generates and signs a new JWT token with the given secret and given permissions.

Types

type JWTPayload

type JWTPayload struct {
	Allow []auth.Permission
}

JWTPayload is a utility struct for marshaling/unmarshalling permissions into for token signing/verifying.

func (*JWTPayload) MarshalBinary

func (j *JWTPayload) MarshalBinary() (data []byte, err error)

Jump to

Keyboard shortcuts

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