auth

package
v0.0.0-...-2523971 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AccountID = "accountID"

AccountID is the context key used when adding/retrieven the account ID from a gin.Context

Variables

View Source
var ErrNotAuthenticated = errors.New("no authentication found")

ErrNotAuthenticated is returned if no authentication has been found

Functions

func AccountFromRequest

func AccountFromRequest(cli *authn.Client, ctx *gin.Context) (string, error)

AccountFromRequest returns the account ID that is used in the request

func GetAccountID

func GetAccountID(ctx *gin.Context) (string, bool)

GetAccountID returns the account ID associated with a request. The request route must be annotated with RequireAuth() for the account ID to be loaded and stored in the request context

func Permission

func Permission(action string, rfn ExtractResourceFunc) gin.HandlerFunc

Permission returns a middleware function that checks permissions against an authz server

func Required

func Required() gin.HandlerFunc

Types

type ExtractResourceFunc

type ExtractResourceFunc func(ctx *gin.Context) (string, error)

ExtractResourceFunc should return the target resource URN of the given request

func ConstantName

func ConstantName(name string) ExtractResourceFunc

ConstantName returns an ExtractResourceFunc that always returns name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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