middleware

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package middleware provides HTTP middleware for authorization.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthorization

func GetAuthorization(ctx context.Context) string

GetAuthorization retrieves the bearer token from the context.

func NewAuthorizationHandler

func NewAuthorizationHandler(handler http.Handler) http.Handler

NewAuthorizationHandler wraps an http.Handler with authorization extraction.

func WithAuthorization

func WithAuthorization(ctx context.Context, token string) context.Context

WithAuthorization stores the bearer token in the context.

func WithBearerAuth

func WithBearerAuth(c *http.Client) *http.Client

WithBearerAuth wraps an HTTP client to forward bearer tokens from context.

Types

type AuthorizationHandler

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

AuthorizationHandler extracts the Authorization header and stores it in the context.

func (*AuthorizationHandler) ServeHTTP

func (h *AuthorizationHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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