jwt

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

* @Author: LinkLeong link@icewhale.com * @Date: 2021-09-30 18:18:14 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-18 17:30:38 * @FilePath: /CasaOS/pkg/utils/jwt/jwt.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

* @Author: LinkLeong link@icewhale.com * @Date: 2022-06-17 14:01:25 * @LastEditors: LinkLeong * @LastEditTime: 2022-07-29 16:22:25 * @FilePath: /CasaOS/pkg/utils/jwt/jwt_helper.go * @Description: * @Website: https://www.casaos.io * Copyright (c) 2022 by icewhale, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateToken

func GenerateToken(username, password string, id int, issuer string, t time.Duration) (string, error)

创建token

func GetAccessToken added in v0.3.4

func GetAccessToken(username, pwd string, id int) string

get AccessToken

func GetRefreshToken added in v0.3.4

func GetRefreshToken(username, pwd string, id int) string

func JWT

func JWT() gin.HandlerFunc

Types

type Claims

type Claims struct {
	Username string `json:"username"`
	PassWord string `json:"password"`
	Id       int    `json:"id"`
	jwt.RegisteredClaims
}

func ParseToken

func ParseToken(token string, valid bool) (*Claims, error)

解析token

Jump to

Keyboard shortcuts

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