gate

package
Version: v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Admin

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

func Member

func Member(g Authenticator, 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 Authenticator, idfunc func(echo.Context, string) (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 Mod added in v0.2.5

func Mod(g Authenticator, idparam string) echo.MiddlewareFunc

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

func ModF added in v0.2.5

func ModF(g Authenticator, idfunc func(echo.Context, string) (string, error)) echo.MiddlewareFunc

ModF 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 Authenticator, idparam string) echo.MiddlewareFunc

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

func OwnerF

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

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

idfunc should return the userid

func OwnerOrAdmin

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

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

func OwnerOrAdminF added in v0.2.5

func OwnerOrAdminF(g Authenticator, idfunc func(echo.Context, string) (string, error)) echo.MiddlewareFunc

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

idfunc should return the userid

func OwnerOrMemberF added in v0.2.5

func OwnerOrMemberF(g Authenticator, idfunc func(echo.Context, string) (string, string, error)) echo.MiddlewareFunc

OwnerOrMemberF is a middleware function to validate if the request is made by the owner or a group member

idfunc should return the userid and the group_tag

func System

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

func User

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

func UserOrBan

func UserOrBan(g Authenticator, 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 Authenticator, idfunc func(echo.Context, string) (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 Authenticator added in v0.2.7

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

Authenticator creates new authenticating middleware

type Gate

type Gate interface {
	Authenticator
	WithApikey() Authenticator
}

Gate creates new middleware to gate routes

type Intersector added in v0.2.5

type Intersector interface {
	Userid() string
	Intersect(roles rank.Rank) (rank.Rank, bool)
	Context() echo.Context
}

Intersector is a function that returns roles needed to validate a user

type Service

type Service interface {
	governor.Service
	Gate
}

func New

func New(roles role.Role, apikeys apikey.Apikey, tokenizer token.Tokenizer) Service

New returns a new Gate

type Validator

type Validator func(r Intersector) bool

Validator is a function to check the authorization of a user

Source Files

Jump to

Keyboard shortcuts

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