jwt

package
v0.3.4-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

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-18 17:31:15 * @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