jwt_exchange

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultProxyDirector

func DefaultProxyDirector(rawUrl string) func(req *http.Request)

func StartNewJwkCache

func StartNewJwkCache(jwksUrl string, refreshInterval time.Duration, stopOnError bool) jwksCache

Types

type BearerJwtClaimsExtractor

type BearerJwtClaimsExtractor struct {
	HeaderName string
	TrimPrefix bool
	Prefix     string
	Audience   string
	Validator  TokenValidator
}

func (*BearerJwtClaimsExtractor) Extract

type ClaimsExtractor

type ClaimsExtractor interface {
	Extract(req *http.Request) (jwt.MapClaims, error)
}

type ClaimsMapper

type ClaimsMapper interface {
	MapClaims(claims jwt.MapClaims) (jwt.Claims, error)
}

type FancyClaimsMapper

type FancyClaimsMapper struct {
	TokenTTL     int64
	Audience     string
	StaticClaims map[string]string
	MappedClaims map[string]string
}

func (FancyClaimsMapper) MapClaims

func (fcm FancyClaimsMapper) MapClaims(claims jwt.MapClaims) (jwt.Claims, error)

type GenericTokenCreator

type GenericTokenCreator struct {
	CreationFunc func(orginalClaims jwt.MapClaims) (string, error)
}

func (GenericTokenCreator) CreateToken

func (g GenericTokenCreator) CreateToken(orginalClaims jwt.MapClaims) (string, error)

type HeaderTokenWriter

type HeaderTokenWriter struct {
	HeaderName string
	Prefix     string
}

func (HeaderTokenWriter) Write

func (htw HeaderTokenWriter) Write(r *http.Request, token string)

type JwtCreator_HS256

type JwtCreator_HS256 struct {
	JwtSecret []byte
}

func (JwtCreator_HS256) CreateToken

func (j JwtCreator_HS256) CreateToken(inputClaims jwt.Claims) (string, error)

type TokenCreator

type TokenCreator interface {
	CreateToken(orginalClaims jwt.Claims) (string, error)
}

Creates the outgoing token from provided claims

type TokenExchangeHandler

type TokenExchangeHandler struct {
	ClaimsExtractor   ClaimsExtractor
	ClaimsMapper      ClaimsMapper
	TokenCreator      TokenCreator
	HeaderTokenWriter HeaderTokenWriter
	Director          func(r *http.Request)
}

func (TokenExchangeHandler) ProxyHandler

func (teh TokenExchangeHandler) ProxyHandler() func(w http.ResponseWriter, r *http.Request)

type TokenHeaderField

type TokenHeaderField struct {
	// contains filtered or unexported fields
}

type TokenReader

type TokenReader interface {
	Read(re *http.Request) string
}

type TokenValidator

type TokenValidator interface {
	Validate(token string) (jwt.MapClaims, error)
}

validates the incoming token and extracts MapClaims

type TokenWriter

type TokenWriter interface {
	Write(w http.ResponseWriter)
}

Jump to

Keyboard shortcuts

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