authorize

package
v2.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name          = "authorize"
	CurrentClaims = "claims"
)

Variables

This section is empty.

Functions

func ToContext

func ToContext(ctx context.Context, claim *Claims) context.Context

Types

type Authorize

type Authorize interface {
	Authorize(auth authenticate.Authenticate, scopes ...string) (*Claims, error)
}

type Claims

type Claims struct {
	ID       string   `json:"id,omitempty"`
	Unit     string   `json:"unit,omitempty"`
	Username string   `json:"username,omitempty"`
	Name     string   `json:"name,omitempty"`
	Surname  string   `json:"surname,omitempty"`
	Email    string   `json:"email,omitempty"`
	Phone    string   `json:"phone,omitempty"`
	Scopes   []string `json:"scopes,omitempty"`
}

func Authorized

func Authorized(ctx context.Context, token authenticate.Authenticate, scopes ...string) (*Claims, error)

func FromContext

func FromContext(ctx context.Context) *Claims

Jump to

Keyboard shortcuts

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