jwt

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ALGRAS         = "rsa"
	ACCESS         = "access"
	REGISTERVERIFY = "register_verify"
	PASSWORDRESET  = "password_reset"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessPayload added in v0.4.0

type AccessPayload struct {
	Payload
	UserID uint     `json:"sub"`
	AppID  string   `json:"iss"`
	Scopes []string `json:"scopes"`
}

func NewAccessPayload added in v0.4.0

func NewAccessPayload(userID uint, scopes string, appID string, expire int64) *AccessPayload
type Head struct {
	Type string `json:"type"`
	Alg  string `json:"alg"`
}

type IDTokenPayload added in v1.0.0

type IDTokenPayload struct {
	Payload
	UserID uint   `json:"sub"`
	AppID  string `json:"iss"`
	Role   string `json:"role"`
	Name   string `json:"name"`
	Mail   string `json:"mail"`
}

func NewIDTokenPayload added in v1.0.0

func NewIDTokenPayload(userID uint, role, name, mail, appID string, expire int64) *IDTokenPayload

type JWT

type JWT struct {
	Head    []byte
	Payload []byte
	Sign    []byte
}

func GenerateRSAJWT

func GenerateRSAJWT(payload interface{}) (*JWT, *perror.PlutoError)

func VerifyB64JWT

func VerifyB64JWT(b64JWTToken string) (*JWT, *perror.PlutoError)

func VerifyJWT added in v0.2.2

func VerifyJWT(token string) (*JWT, *perror.PlutoError)

func (*JWT) B64String

func (jwt *JWT) B64String() string

func (*JWT) String

func (jwt *JWT) String() string

type PasswordResetPayload

type PasswordResetPayload struct {
	Payload
	Mail string `json:"mail"`
}

func NewPasswordResetPayload

func NewPasswordResetPayload(mail string, expire int64) *PasswordResetPayload

type PasswordResetResultPayload

type PasswordResetResultPayload struct {
	Payload
	Successed bool `json:"successed"`
}

type Payload

type Payload struct {
	Type   string `json:"type"`
	Create int64  `json:"iat"`
	Expire int64  `json:"exp"`
}

type RegisterVerifyPayload

type RegisterVerifyPayload struct {
	Payload
	UserID uint `json:"sub"`
}

func NewRegisterVerifyPayload

func NewRegisterVerifyPayload(userID uint, expire int64) *RegisterVerifyPayload

Jump to

Keyboard shortcuts

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