jwt

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

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

Go to latest
Published: Apr 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(decoder *Decoder, next http.Handler) http.Handler

AuthMiddleware ...

Types

type ContextKey

type ContextKey string

type for CTX jwt key

const ContextJWTKey ContextKey = "jwt"

CTX JWT key

type Decoder

type Decoder struct {
	KeyServerURL string
	DevMode      bool
}

Decoder ...

func New

func New() *Decoder

New decoder

func (Decoder) Decode

func (d Decoder) Decode(t string) *JSONWebToken

Decode ...

func (Decoder) Verify

func (d Decoder) Verify(t JSONWebToken, raw string) JSONWebToken

Verify ...

type JSONWebToken

type JSONWebToken struct {
	Version   int      `json:"ver"`
	ID        string   `json:"jti"`
	Issuer    string   `json:"iss"`
	Audience  string   `json:"aud"`
	IssuedAt  int      `json:"iat"`
	ExpiresAt int      `json:"exp"`
	ClientID  string   `json:"cid"`
	UserID    string   `json:"uid"`
	Scopes    []string `json:"scp"`
	Subject   string   `json:"sub"`
	Groups    []string `json:"groups"`
	IsValid   bool     `json:"is_valid"`
}

JSONWebToken ...

func FromContext

func FromContext(ctx context.Context) (*JSONWebToken, error)

FromContext ...

Jump to

Keyboard shortcuts

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