irisMiddlewares

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTokenName    = "token"
	AuthUserIdCtxKey = "auth_uid"
)
View Source
const IrisCtxKey = "irisctx"

Variables

View Source
var AuthCfg = &authCfgType{
	CookieExpires: 7 * 24 * time.Hour,
}

Functions

func FromStd

func FromStd(handler http.HandlerFunc) iris.Handler

FromStd convert std handler to iris.Handler, with iris context embedded

func GetIrisCtxFromStdCtx added in v1.2.1

func GetIrisCtxFromStdCtx(ctx context.Context) iris.Context

Types

type Auth

type Auth struct {
	utils.JWT
	// contains filtered or unexported fields
}

func NewAuth added in v1.2.3

func NewAuth(cfg *authCfgType) *Auth

func (*Auth) SetLoginCookie added in v1.2.3

func (a *Auth) SetLoginCookie(ctx context.Context, user UserItf) (err error)

SetLoginCookie set jwt token to cookies

func (*Auth) ValidateAndGetUID added in v1.2.3

func (a *Auth) ValidateAndGetUID(ctx context.Context) (uid bson.ObjectId, err error)

type UserItf added in v1.2.3

type UserItf interface {
	GetPayload() map[string]interface{}
	GetID() string
}

Jump to

Keyboard shortcuts

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