jwtmanager

package
v0.6.9 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomClaims map[string]interface{}

CustomClaims implementation

View Source
var Sites []string

Sites added to VouchClaims

View Source
var StandardClaims jwt.StandardClaims

StandardClaims jwt.StandardClaims implementation

Functions

func CreateUserTokenString

func CreateUserTokenString(u structs.User, customClaims structs.CustomClaims, ptokens structs.PTokens) string

CreateUserTokenString converts user to signed jwt

func PTokenToUsername added in v0.2.6

func PTokenToUsername(ptoken *jwt.Token) (string, error)

PTokenToUsername returns the Username in the validated ptoken

func ParseTokenString

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

ParseTokenString converts signed token to jwt struct

func SiteInClaims

func SiteInClaims(site string, claims *VouchClaims) bool

SiteInClaims does the claim contain the value?

func SiteInToken

func SiteInToken(site string, token *jwt.Token) bool

SiteInToken searches does the token contain the site?

func TokenIsValid

func TokenIsValid(token *jwt.Token, err error) bool

TokenIsValid gett better error reporting

Types

type VouchClaims added in v0.4.0

type VouchClaims struct {
	Username     string   `json:"username"`
	Sites        []string `json:"sites"` // tempting to make this a map but the array is fewer characters in the jwt
	CustomClaims map[string]interface{}
	PAccessToken string
	PIdToken     string
	jwt.StandardClaims
}

VouchClaims jwt Claims specific to vouch

func PTokenClaims

func PTokenClaims(ptoken *jwt.Token) (VouchClaims, error)

PTokenClaims get all the claims TODO HERE there's something wrong with claims parsing, probably related to VouchClaims not being a pointer

Jump to

Keyboard shortcuts

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