middleware

package
v0.0.0-...-2d369e4 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromAuthHeader

func FromAuthHeader(r *http.Request) (string, error)

FromAuthHeader is a "TokenExtractor" that takes a give request and extracts the JWT token from the Authorization header.

func OnError

func OnError(w http.ResponseWriter, r *http.Request, err string)

Types

type Options

type Options struct {

	// The name of the property in the request where the user information
	// from the JWT will be stored.
	// Default value: "user"
	XssecProperty string
	// The function that will be called when there's an error validating the token
	// Default value:
	ErrorHandler errorHandler
	// Debug flag turns on debugging output
	// Default: false
	Debug bool
	// Function to Validate JKU
	JKUValidator validation.JKUValidationFunc
	// Function to make xsuaa specific audience and clientId checks
	AudienceValidator validation.JWTValidationFunc
	// The function that will return the Key to validate the JWT.
	// It can be either a shared secret or a public key.
	// Default value: nil
	ValidationKeyGetter jwt.Keyfunc
}

Options is a struct for specifying configuration options for the middleware.

type XssecMiddleware

type XssecMiddleware struct {
	Options     Options
	XsuaaConfig config.XsuaaConfig
}

func NewXssecMiddleware

func NewXssecMiddleware(xsuaaConfig config.XsuaaConfig, options ...Options) (*XssecMiddleware, error)

New constructs a new Secure instance with supplied options.

func (*XssecMiddleware) CheckJWT

func (m *XssecMiddleware) CheckJWT(w http.ResponseWriter, r *http.Request) error

func (*XssecMiddleware) Handler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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