extractor

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromRawCookies

func FromRawCookies(rawCookies string) []*http.Cookie

FromRawCookies takes a raw cookie string and returns a slice of *http.Cookie

func ValuesFromCookie

func ValuesFromCookie(name, cookiesRaw string) ([]string, error)

ValuesFromCookie returns a function that extracts values from the named cookie.

func ValuesFromHeader

func ValuesFromHeader(values []string, valuePrefix string) ([]string, error)

ValuesFromHeader take http.Request.Header.Values and a prefix as input return a slice of string without the prefix when values is empty, return errHeaderExtractorValueMissing when prefix is empty, return the input values, keep the http.Request.Header.Values backing array if there is one when prefix is not empty, return a new slice of values without the prefix

Types

type CookieLookup

type CookieLookup struct {
	Name string
}

func NewCookieExtractor

func NewCookieExtractor(name string) *CookieLookup

func (*CookieLookup) Extract

func (l *CookieLookup) Extract(ctx context.Context, req *middleware.Request) ([]string, error)

type HeaderExtractor

type HeaderExtractor interface {
	Extract(ctx context.Context, req *middleware.Request) ([]string, error)
	Key() string
}

type HeaderLookup

type HeaderLookup struct {
	Name      string
	CutPrefix string // Optional, used only if Source is "header"
}

func BasicTokenExtractor

func BasicTokenExtractor() *HeaderLookup

func JwtTokenExtractor

func JwtTokenExtractor() *HeaderLookup

func NewHeaderExtractor

func NewHeaderExtractor(name, cutPrefix string) *HeaderLookup

func (*HeaderLookup) Extract

func (l *HeaderLookup) Extract(ctx context.Context, req *middleware.Request) ([]string, error)

func (*HeaderLookup) Key

func (l *HeaderLookup) Key() string

Jump to

Keyboard shortcuts

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