jwtgocobra

package module
v0.0.0-...-d45270c Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 6 Imported by: 0

README

jwt-go-cobra

This package include some JWT operations.

Install

go get github.com/aliicoban/jwt-go-cobra

Import

import ( "github.com/aliicoban/jwt-go-cobra" )

Usage

jwtgocobra.MethodName

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateToken

func CreateToken(userid interface{}, expireTime ...time.Duration) (string, error)

Create token by user id.If operation is success return token.Otherwise return error.

func ExtractToken

func ExtractToken(c *gin.Context) string

Parameter is a gin.Context. Extract string token.

func GetUserIdByToken

func GetUserIdByToken(token *jwt.Token) interface{}

Send token and getting the user id.

func TokenValid

func TokenValid(tokenString string) (error, bool)

tokenString type is string.If token is invalid return false otherwise returns true.

func VerifyToken

func VerifyToken(tokenString string) (*jwt.Token, error)

Parameter is string token. Return *jwt.Token type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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