sessionguard

package
v4.2.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLastLoginInfo

func GetLastLoginInfo(ctx echo.Context, ownerType string, ownerId uint64, sessionId string) (*dbschema.NgingLoginLog, error)

func UnsetSession

func UnsetSession(ctx echo.Context, ownerType string)

func Validate

func Validate(ctx echo.Context, lastIP string, ownerType string, ownerId uint64) bool

Validate 验证 session 环境是否安全,避免 cookie 和 session id 被窃取 在非匿名模式下 UserAgent 和 IP 归属地与登录时的一致

Types

type Environment

type Environment struct {
	UserAgent string
	Location  ip2regionparser.IpInfo
}

func GetEnvFromSession

func GetEnvFromSession(ctx echo.Context, ownerType string) *Environment

func (*Environment) SetSession

func (e *Environment) SetSession(ctx echo.Context, ownerType string)

Jump to

Keyboard shortcuts

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