jwt

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Issuer specifies issuer claim
	Issuer string `json:"issuer" yaml:"issuer"`
	// KeyID specifies ID of the current key
	KeyID string `json:"kid" yaml:"kid"`
	// Keys specifies list of issuer's keys
	Keys []*Key `json:"keys" yaml:"keys"`
}

Config provides OAuth2 configuration

func LoadConfig

func LoadConfig(file string) (*Config, error)

LoadConfig returns configuration loaded from a file

type Key

type Key struct {
	// ID of the key
	ID   string `json:"id" yaml:"id"`
	Seed string `json:"seed" yaml:"seed"`
}

Key for JWT signature

type Parser

type Parser interface {
	// ParseToken returns jwt.StandardClaims
	ParseToken(authorization, audience string) (*jwt.StandardClaims, error)
}

Parser specifies JWT parser interface

type Provider

type Provider interface {
	Signer
	Parser
}

Provider specifies JWT provider interface

func Load

func Load(cfgfile string) (Provider, error)

Load returns new provider

func New

func New(cfg *Config) Provider

New returns new provider

type Signer

type Signer interface {
	// SignToken returns signed JWT token
	SignToken(id, subject, audience string, expiry time.Duration) (string, *jwt.StandardClaims, error)
}

Signer specifies JWT signer interface

Jump to

Keyboard shortcuts

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