security

package
v0.0.0-...-6f40e4d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JWTClaims = &jwt.StandardClaims{}

Functions

func GenerateToken

func GenerateToken(claim *TokenClaims) string

func GetClaimsOfJWT

func GetClaimsOfJWT() *jwt.StandardClaims

func VerifyToken

func VerifyToken(tokenString string) bool

Verify the token signature and expire dates without any explicit claims

func VerifyTokenWithClaim

func VerifyTokenWithClaim(tokenString string, claim string) bool

Verify the token signature and expire dates with a claim

Types

type TokenClaims

type TokenClaims struct {
	Issuer     string
	Subject    string
	Audience   string
	Expiration int64
	NotBefore  int64
	IssuedAt   int64
	Id         string
}

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
}

Jump to

Keyboard shortcuts

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