jwt

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDuration = 1 * time.Hour

DefaultDuration is the default time for which the token is valid. Used to generate the expiration time. TODO investigate what a good "Default" duration should be TODO, include refresh tokens and other complicated things as options needed for short durations like this. less needed for longer auth

View Source
var DefaultSigningMethod = jwt.SigningMethodHS512

DefaultSigningMethod is the signing method used to sign the token.

Functions

func GetExpiryTimeFromClaims

func GetExpiryTimeFromClaims(claims jwt.Claims) (int64, error)

func GetIDFromClaims

func GetIDFromClaims(claims jwt.Claims) (string, error)

func GetKeyFromClaims

func GetKeyFromClaims(claims jwt.Claims, key string) (string, error)

func GetSubjectFromClaims

func GetSubjectFromClaims(claims jwt.Claims) (string, error)

Types

type AuthedIdentity

type AuthedIdentity struct {
	Viewer viewer.ViewerContext
	Token  string
}

AuthedIdentity is returned by the Authenticate method. Contains information about the identity which was just logged in

type Claims

type Claims interface {
	jwt.Claims
	ID() string
}

Claims is needed to parse the logged in entity out of the Claims object so that we can pass to VCFromID after using a custom Claims object The ID should reference the underlying ID

type ClaimsWithSubject

type ClaimsWithSubject interface {
	Claims
	Subject() string
}

ClaimsWithSubject is used to get the subject out of a the Claims object so that we can then fetch information about that subject

Jump to

Keyboard shortcuts

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