sec

package
v0.0.0-...-13db65c Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperationTypeAdd    OperationType = "add"
	OperationTypeGet                  = "get"
	OperationTypeUpdate               = "update"
	OperationTypeRemove               = "remove"
)

Variables

This section is empty.

Functions

func BearerAuthenticationMiddleware

func BearerAuthenticationMiddleware(db *bun.DB) func(c *fiber.Ctx) error

func CreateAccessToken

func CreateAccessToken(ctx context.Context, user *model.User) (string, error)

func DeleteExpiredAccessTokens

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

func GenerateUrlSafeSecureRandomString

func GenerateUrlSafeSecureRandomString(n int) (string, error)

func GetUserByAccessToken

func GetUserByAccessToken(ctx context.Context, token string) (*model.User, error)

func GetUserByEmail

func GetUserByEmail(ctx context.Context, email string) (*model.User, error)

func HashPrivilege

func HashPrivilege(user *model.User, operationType OperationType, resourceId string, resourceLabel string) bool

Types

type ApplicationContext

type ApplicationContext struct {
	User *model.User
	Db   *bun.DB
}

type OperationType

type OperationType string

type PrincipalType

type PrincipalType string
const (
	PrincipalTypeUser  PrincipalType = "user"
	PrincipalTypeGroup               = "group"
)

type ResourceType

type ResourceType string
const (
	ResourceTypeUser  ResourceType = "user"
	ResourceTypeGroup ResourceType = "group"
)

Jump to

Keyboard shortcuts

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