middleware

package
v2.0.0-beta.8 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogTrace

func LogTrace(next http.Handler) http.Handler

LogTrace Sets the initial trace in the ocs service.

func OCSFormatCtx

func OCSFormatCtx(next http.Handler) http.Handler

OCSFormatCtx middleware is used to determine the content type from the format URL parameter passed in an ocs request. Defaults to XML

func RequireAdmin

func RequireAdmin(opts ...Option) func(next http.Handler) http.Handler

RequireAdmin middleware is used to require the user in context to be an admin / have account management permissions

func RequireSelfOrAdmin

func RequireSelfOrAdmin(opts ...Option) func(next http.Handler) http.Handler

RequireSelfOrAdmin middleware is used to require the requesting user to be an admin or the requested user himself

func RequireUser

func RequireUser(opts ...Option) func(next http.Handler) http.Handler

RequireUser middleware is used to require a user in context

Types

type Option

type Option func(o *Options)

Option defines a single option function.

func Logger

func Logger(l log.Logger) Option

Logger provides a function to set the logger option.

func RoleManager

func RoleManager(val *roles.Manager) Option

RoleManager provides a function to set the RoleManager option.

type Options

type Options struct {
	// Logger to use for logging, must be set
	Logger log.Logger
	// RoleManager for looking up permissions
	RoleManager *roles.Manager
}

Options defines the available options for this package.

Jump to

Keyboard shortcuts

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