web

package
v0.0.0-...-6edc87d Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SessionName           = "myapp"
	CurrentUserSessionKey = "currentuser"
	RedirectURLSessionKey = "redirecturl"
)

Variables

This section is empty.

Functions

func ExtractFromSession

func ExtractFromSession(ginCtx *gin.Context, key string) (interface{}, bool)

func GetApaleoAuthProvider

func GetApaleoAuthProvider(cfg *config.Config) (*openidConnect.Provider, error)

func InitAuthProviders

func InitAuthProviders(cfg *config.Config) error

func InitSessions

func InitSessions(router *gin.Engine, cfg *config.Config)

func StoreInSession

func StoreInSession(ginCtx *gin.Context, key string, value interface{})

Types

type Context

type Context struct {
	Db        *gorm.DB
	Config    *config.Config
	Ctx       context.Context
	GinCtx    *gin.Context
	Validator *validator.Validate
	Logger    *zap.Logger
	User      *CurrentUser
}

func (*Context) SetCurrentUser

func (ctx *Context) SetCurrentUser(id uuid.UUID, accountCode string)

func (*Context) SetCurrentUserIfExists

func (ctx *Context) SetCurrentUserIfExists()

type CurrentUser

type CurrentUser struct {
	ID          uuid.UUID
	AccountCode string
}

func GetCurrentUser

func GetCurrentUser(ginCtx *gin.Context) (CurrentUser, error)

type HandlerFunc

type HandlerFunc func(*Context) HandlerResult

type HandlerResult

type HandlerResult interface {
	Render(c *gin.Context)
}

type HtmlResult

type HtmlResult struct {
	Status   int
	Template string
	Params   gin.H
}

func (HtmlResult) Render

func (r HtmlResult) Render(c *gin.Context)

type JsonResult

type JsonResult struct {
	Status int
	Json   interface{}
}

func (JsonResult) Render

func (r JsonResult) Render(c *gin.Context)

Jump to

Keyboard shortcuts

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