auth

package
v0.0.0-...-ae6a5fa Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HttpHeaderAuthorization = "Authorization"
)

Variables

View Source
var (
	ErrMissingAuthorizationHeader = errors.New("HTTP request has no valid Bearer authentication; expecting header like 'Authorization: Bearer <token>'")
	ErrInvalidAuthorizationToken  = errors.New("HTTP request has invalid bearer token'")
)

Functions

func EncodeHTTPRequestClaims

func EncodeHTTPRequestClaims(r *http.Request, claims Claims) error

Types

type Claims

type Claims map[string]any

func DecodeHTTPRequestClaims

func DecodeHTTPRequestClaims(r *http.Request) (Claims, error)

func NewClaims

func NewClaims(user string, isAdmin, isSystem bool) Claims

func (Claims) IsAdmin

func (c Claims) IsAdmin() bool

func (Claims) IsAdminOrSystem

func (c Claims) IsAdminOrSystem() bool

func (Claims) IsSystem

func (c Claims) IsSystem() bool

func (Claims) User

func (c Claims) User() string

Jump to

Keyboard shortcuts

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