middleware

package
v0.0.0-...-c387957 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(userRepo *repository.UserService) func(http.Handler) http.Handler

Types

type UserContextValue

type UserContextValue struct {
	User     *models.User
	AuthType string
}

We distinguish the type of authentication so we can restrict service tokens to only be used for work requests

func AuthorizedChangePassword

func AuthorizedChangePassword(ctx context.Context) *UserContextValue

AuthorizedChangePassword getsuser from context if they are authorized to change their password

func AuthorizedProvider

func AuthorizedProvider(ctx context.Context) *UserContextValue

AuthorizedProvider returns user from context if they are an authorized provider type

func AuthorizedRequester

func AuthorizedRequester(ctx context.Context) *UserContextValue

AuthorizedRequester returns user from context if they are an authorized requester

func AuthorizedServiceToken

func AuthorizedServiceToken(ctx context.Context) *UserContextValue

AuthorizedServiceToken returns user from context if they are an authorized service token

func AuthorizedUser

func AuthorizedUser(ctx context.Context) *UserContextValue

AuthorizedUser returns user from context if they are logged in

Jump to

Keyboard shortcuts

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