withuser

package
v0.0.0-...-16952c6 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthNone = AuthLevel(0)
	AuthUser = AuthLevel(1)
	AuthOrg  = AuthLevel(2)
	AuthRoot = AuthLevel(3)
	AuthPeer = AuthLevel(4)
)

Variables

View Source
var AuthKey = AuthType("auth")
View Source
var ErrorAuthLevelInvalid = errors.New("auth level invalid")
View Source
var OrgKey = OrgType("org")
View Source
var UserKey = UserType("user")

Functions

func GetOrg

func GetOrg(r *http.Request) *org.Org

GetOrg returns the org. Panic indicates coding error.

func GetUser

func GetUser(r *http.Request) *user.User

GetUser returns the user. Panic indicates coding error.

func Middleware

func Middleware(st *app.State) func(http.Handler) http.Handler

Middleware checks user and org for the incoming request, as indicated by the x-grokloc-id header. Following this middleware, the caller's user and org info are available from the request context.

Types

type AuthLevel

type AuthLevel int

func GetAuth

func GetAuth(r *http.Request) AuthLevel

GetAuth returns the auth level int. Panic indicates coding error.

type AuthType

type AuthType string

type OrgType

type OrgType string

type UserType

type UserType string

Jump to

Keyboard shortcuts

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