jwt

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RS256ALGRAS    = "RS256"
	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    string
	Payload string
	Sign    string
}

func GenerateRSA256JWT added in v1.3.1

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

func VerifyB64RS256JWT added in v1.3.1

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

func VerifyRS256JWT added in v1.3.1

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

func (*JWT) B64String

func (jwt *JWT) B64String() string

func (*JWT) String

func (jwt *JWT) String() string

func (*JWT) UnmarshalPayload added in v1.3.2

func (jwt *JWT) UnmarshalPayload(v interface{}) *perror.PlutoError

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