auth

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanUp

func CleanUp(db *gorm.DB, interval time.Duration, close chan bool)

CleanUp clean up expired devices

func GetCreateSession

func GetCreateSession(ctx context.Context) func(token string, age int)

GetCreateSession gets the create session callback

func GetDestroySession

func GetDestroySession(ctx context.Context) func()

GetDestroySession gets the destroy session callback

func GetDevice

func GetDevice(ctx context.Context) *model.Device

GetDevice returns the authenticated device or nil.

func GetUser

func GetUser(ctx context.Context) *model.User

GetUser returns the authenticated user or panics.

func HasRole

func HasRole() func(ctx context.Context, obj interface{}, next graphql.Resolver, role gqlmodel.Role) (res interface{}, err error)

HasRole checks if the current user has sufficient permissions.

func Middleware

func Middleware(db *gorm.DB) mux.MiddlewareFunc

Middleware is the auth middleware which sets user and device context parameters.

func WithCreateSession

func WithCreateSession(ctx context.Context, f func(token string, age int)) context.Context

WithCreateSession adds the create session method

func WithDestroySession

func WithDestroySession(ctx context.Context, f func()) context.Context

WithDestroySession adds the destroy session method

func WithDevice

func WithDevice(ctx context.Context, device *model.Device) context.Context

WithDevice adds the authenticated device to the context.

func WithUser

func WithUser(ctx context.Context, user *model.User) context.Context

WithUser adds the authenticated user to the context.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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