Documentation
¶
Index ¶
- Constants
- type JwtService
- func (thiz *JwtService) CreateToken(payload map[string]interface{}, duration time.Duration) (string, error)
- func (thiz *JwtService) MustCreateToken(payload map[string]interface{}, duration time.Duration) string
- func (thiz *JwtService) VerifyAndParseClaims(tokenString string) (map[string]interface{}, error)
Constants ¶
View Source
const HOURS = "hours"
View Source
const HS256 string = "HS256"
View Source
const MINUTES = "minutes"
View Source
const RS256 string = "RS256"
View Source
const SECONDS = "seconds"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JwtService ¶
type JwtService struct {
// contains filtered or unexported fields
}
func NewJwtService ¶
func NewJwtService(signMethod, signKey, verifyKey string) *JwtService
func (*JwtService) CreateToken ¶
func (thiz *JwtService) CreateToken(payload map[string]interface{}, duration time.Duration) (string, error)
创建一个JWT并签名
func (*JwtService) MustCreateToken ¶
func (thiz *JwtService) MustCreateToken(payload map[string]interface{}, duration time.Duration) string
func (*JwtService) VerifyAndParseClaims ¶
func (thiz *JwtService) VerifyAndParseClaims(tokenString string) (map[string]interface{}, error)
验证并解析token
Click to show internal directories.
Click to hide internal directories.