jwt

package
v0.0.0-...-796898b Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package jwt jwt操作工具

Index

Constants

View Source
const (
	// SigningMethodHS256 HS256
	SigningMethodHS256 = iota
	// SigningMethodHS384 HS384
	SigningMethodHS384
	// SigningMethodHS512 HS512
	SigningMethodHS512
)

Variables

This section is empty.

Functions

func Build

func Build(method int, key interface{}, sub, iss, jti string, iat, nbf, exp int64) (string, error)

Build 创建一个 jwt token "sub": "1", 该JWT所面向的用户 "iss": "http://localhost:8000/user/sign_up", 该JWT的签发者 "iat": 1451888119, 在什么时候签发的token "exp": 1454516119, token什么时候过期 "nbf": 1451888119, token在此时间之前不能被接收处理 "jti": "37c107e4609ddbcc9c096ea5ee76c667" token提供唯一标识

func Check

func Check(key interface{}, token string) bool

Check 验证传入 token 是否合法

Types

This section is empty.

Jump to

Keyboard shortcuts

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