gate

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Admin

func Admin(g Gate) echo.MiddlewareFunc

Admin is a middleware function to validate if a user is an admin

func Member

func Member(g Gate, idparam string) echo.MiddlewareFunc

Member is a middleware function to validate if the request is made by a member of a group and check if the user is banned from the group

func MemberF

func MemberF(g Gate, idfunc func(echo.Context) (string, error)) echo.MiddlewareFunc

MemberF is a middleware function to validate if the request is made by a member of a group and check if the user is banned from the group

idfunc should return the group_tag

func ModOrAdminF

func ModOrAdminF(g Gate, idfunc func(echo.Context) (string, error)) echo.MiddlewareFunc

ModOrAdminF is a middleware function to validate if the request is made by the moderator of a group or an admin

idfunc should return the group_tag

func Owner

func Owner(g Gate, idparam string) echo.MiddlewareFunc

Owner is a middleware function to validate if a user owns the accessed resource

func OwnerF

func OwnerF(g Gate, idfunc func(echo.Context) (string, error)) echo.MiddlewareFunc

OwnerF is a middleware function to validate if a user owns the accessed resource

idfunc should return the userid

func OwnerModOrAdminF

func OwnerModOrAdminF(g Gate, idfunc func(echo.Context) (string, string, error)) echo.MiddlewareFunc

OwnerModOrAdminF is a middleware function to validate if the request is made by the owner or a moderator

idfunc should return the userid and the group_tag

func OwnerOrAdmin

func OwnerOrAdmin(g Gate, idparam string) echo.MiddlewareFunc

OwnerOrAdmin is a middleware function to validate if the request is made by the owner or an admin

func System

func System(g Gate) echo.MiddlewareFunc

System is a middleware function to validate if the request is made by a system

func User

func User(g Gate) echo.MiddlewareFunc

User is a middleware function to validate if the request is made by a user

func UserOrBan

func UserOrBan(g Gate, idparam string) echo.MiddlewareFunc

UserOrBan is a middleware function to validate if the request is made by a user and check if the user is banned from the group

func UserOrBanF

func UserOrBanF(g Gate, idfunc func(echo.Context) (string, error)) echo.MiddlewareFunc

UserOrBanF is a middleware function to validate if the request is made by a user and check if the user is banned from the group

idfunc should return the group_tag

Types

type Gate

type Gate interface {
	Authenticate(v Validator, subject string) echo.MiddlewareFunc
}

Gate creates new middleware to gate routes

type Service

type Service interface {
	governor.Service
	Gate
}

func New

func New() Service

New returns a new Gate

type Validator

type Validator func(c echo.Context, claims token.Claims) bool

Validator is a function to check the authorization of a user

Jump to

Keyboard shortcuts

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