jwt

package
v0.0.0-...-acda5ee Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//TemplatesClaimsOriginUI is assigned to Templates claims when the Auth Token is generated through the UI
	TemplatesClaimsOriginUI = "ui"
	//TemplatesClaimsOriginAPI is assigned to Templates claims when the Auth Token is generated through the API
	TemplatesClaimsOriginAPI = "api"
)

Variables

This section is empty.

Functions

func Encode

func Encode(claims jwtgo.Claims) (string, error)

Encode creates new JWT token with given claims

func Time

func Time(t time.Time) *jwtgo.NumericDate

Types

type Metadata

type Metadata = jwtgo.RegisteredClaims

Metadata is the basic JWT information

type OAuthClaims

type OAuthClaims struct {
	OAuthID       string `json:"oauth/id"`
	OAuthProvider string `json:"oauth/provider"`
	OAuthName     string `json:"oauth/name"`
	OAuthEmail    string `json:"oauth/email"`
	Metadata
}

OAuthClaims represents what goes into temporary OAuth JWT tokens

func DecodeOAuthClaims

func DecodeOAuthClaims(token string) (*OAuthClaims, error)

DecodeOAuthClaims extract OAuthClaims from given JWT token

type TemplatesClaims

type TemplatesClaims struct {
	UserID    int    `json:"user/id"`
	UserName  string `json:"user/name"`
	UserEmail string `json:"user/email"`
	Origin    string `json:"origin"`
	Metadata
}

TemplatesClaims represents what goes into JWT tokens

func DecodeTemplatesClaims

func DecodeTemplatesClaims(token string) (*TemplatesClaims, error)

DecodeTemplatesClaims extract claims from JWT tokens

Jump to

Keyboard shortcuts

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