engine

package
v0.0.0-...-45c2084 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureException

func CaptureException(err error)

func WrapAction

func WrapAction(action ActionFN) gin.HandlerFunc

Types

type ActionFN

type ActionFN func(*Context)

type Context

type Context struct {
	*gin.Context
}

func Ctx

func Ctx(ctx *gin.Context) *Context

func (*Context) Ctx

func (c *Context) Ctx() context.Context

func (*Context) GetCookieToken

func (c *Context) GetCookieToken() (string, error)

func (*Context) GetSession

func (c *Context) GetSession() (domain.Session, bool)

func (*Context) GetStore

func (c *Context) GetStore() storage.IStore

func (*Context) HandleError

func (c *Context) HandleError(err error)

func (*Context) IsOtpValid

func (c *Context) IsOtpValid(passcode string, secret string) bool

func (*Context) JwtOpts

func (c *Context) JwtOpts() jwt.Opts

func (*Context) MustBindProto

func (c *Context) MustBindProto(m proto.Message) error

func (*Context) MustGetOpts

func (c *Context) MustGetOpts() Opts

func (*Context) MustGetSession

func (c *Context) MustGetSession() domain.Session

func (*Context) MustGetUser

func (c *Context) MustGetUser() domain.User

MustGetUser returns session user

func (*Context) MustGetVer

func (c *Context) MustGetVer() *pack.Ver

func (*Context) NewUserPolicy

func (c *Context) NewUserPolicy(user domain.User) policy.IUserPolicy

func (*Context) NewWorkspacePolicy

func (c *Context) NewWorkspacePolicy(user domain.User, uw domain.UserWorkspace) policy.IWorkspacePolicy

func (*Context) OtpIssue

func (c *Context) OtpIssue(user domain.User) (secret string, url string, err error)

func (*Context) SetCookieToken

func (c *Context) SetCookieToken(token string)

func (*Context) SetOpts

func (c *Context) SetOpts(opts Opts) *Context

func (*Context) SetSession

func (c *Context) SetSession(session domain.Session)

func (*Context) SetStore

func (c *Context) SetStore(store storage.IStore) *Context

type Engine

type Engine = gin.Engine

func New

func New(store storage.IStore, opts Opts) (*Engine, error)

type Opts

type Opts struct {
	AllowOrigin     []string
	JwtKey          []byte
	CookieDomain    string
	CookieSecure    bool
	Production      bool
	BackupUrl       string
	OtpStub         string
	SentryDsn       string
	Ver             *pack.Ver
	UserPolicy      policy.IUserPolicy
	WorkspacePolicy policy.IWorkspacePolicy
}

func (*Opts) SetDefaultPolicies

func (o *Opts) SetDefaultPolicies()

Jump to

Keyboard shortcuts

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