auth

package
v0.0.0-...-53d016b Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UCINFO_SALT = "@**fuhsicloud**@"
	KEY_TOKEN   = "Fuhsi-Token"
	EXPIRE      = 7 * 24 * 3600
)

Variables

This section is empty.

Functions

This section is empty.

Types

type UCInfo

type UCInfo struct {
	Uid   int64 `json:"uid"`
	Ctime int64 `json:"ctime"`
}

tips: data = json.Marshal(UCInfo) sign = md5(data + salt) Nvwa-Token = 3des(data + SALT + sign)

type UserAuth

type UserAuth struct{}

func NewUserAuth

func NewUserAuth() *UserAuth

func (*UserAuth) ParseUserTokenFromHeader

func (t *UserAuth) ParseUserTokenFromHeader(ctx *context.Context) (*UCInfo, error)

解析 Header 中的 Token

func (*UserAuth) UCInfoDecrypt

func (t *UserAuth) UCInfoDecrypt(data string) (*UCInfo, error)

func (*UserAuth) UCInfoEncrypt

func (t *UserAuth) UCInfoEncrypt(ucInfo *UCInfo) (string, error)

func (*UserAuth) UCInfoEncryptByUid

func (t *UserAuth) UCInfoEncryptByUid(uid int64) (string, int64, error)

Jump to

Keyboard shortcuts

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