middleware

package
v0.0.0-...-7ff5ae3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdmissionMiddleware

func AdmissionMiddleware(
	logger *zap.Logger,
	resource *authorization.Resource,
	matchClaims map[string]string,
	accessForbidden func(wrt http.ResponseWriter, req *http.Request) context.Context,
) func(http.Handler) http.Handler

AdmissionMiddleware is responsible for checking the access token against the protected resource

func AuthenticationMiddleware

func AuthenticationMiddleware(
	logger *zap.Logger,
	cookieAccessName string,
	cookieRefreshName string,
	getIdentity func(req *http.Request, tokenCookie string, tokenHeader string) (*models.UserContext, error),
	httpClient *http.Client,
	enableIDPSessionCheck bool,
	provider *oidc3.Provider,
	skipTokenVerification bool,
	clientID string,
	skipAccessTokenClientIDCheck bool,
	skipAccessTokenIssuerCheck bool,
	accessForbidden func(wrt http.ResponseWriter, req *http.Request) context.Context,
	enableRefreshTokens bool,
	redirectionURL string,
	cookMgr *cookie.Manager,
	enableEncryptedToken bool,
	forceEncryptedCookie bool,
	encryptionKey string,
	redirectToAuthorization func(wrt http.ResponseWriter, req *http.Request) context.Context,
	newOAuth2Config func(redirectionURL string) *oauth2.Config,
	store storage.Storage,
	accessTokenDuration time.Duration,
) func(http.Handler) http.Handler

AuthenticationMiddleware is responsible for verifying the access token

func DenyMiddleware

func DenyMiddleware(
	logger *zap.Logger,
	accessForbidden func(wrt http.ResponseWriter, req *http.Request) context.Context,
) func(http.Handler) http.Handler

DenyMiddleware

func EntrypointMiddleware

func EntrypointMiddleware(logger *zap.Logger) func(http.Handler) http.Handler

entrypointMiddleware is custom filtering for incoming requests

func ForwardAuthMiddleware

func ForwardAuthMiddleware(logger *zap.Logger, oAuthURI string) func(http.Handler) http.Handler

ForwardAuthMiddleware

func HmacMiddleware

func HmacMiddleware(logger *zap.Logger, encKey string) func(http.Handler) http.Handler

HmacMiddleware verifies hmac

func IdentityHeadersMiddleware

func IdentityHeadersMiddleware(
	logger *zap.Logger,
	custom []string,
	cookieAccessName string,
	cookieRefreshName string,
	noProxy bool,
	enableTokenHeader bool,
	enableAuthzHeader bool,
	enableAuthzCookies bool,
) func(http.Handler) http.Handler

IdentityHeadersMiddleware is responsible for adding the authentication headers to upstream

func LoggingMiddleware

func LoggingMiddleware(
	logger *zap.Logger,
	verbose bool,
) func(http.Handler) http.Handler

loggingMiddleware is a custom http logger

func MethodCheckMiddleware

func MethodCheckMiddleware(logger *zap.Logger) func(http.Handler) http.Handler

MethodCheck middleware

func ProxyDenyMiddleware

func ProxyDenyMiddleware(logger *zap.Logger) func(http.Handler) http.Handler

ProxyDenyMiddleware just block everything

func ProxyMiddleware

func ProxyMiddleware(
	logger *zap.Logger,
	corsOrigins []string,
	headers map[string]string,
	endpoint *url.URL,
	preserveHost bool,
	upstream core.ReverseProxy,
) func(http.Handler) http.Handler

ProxyMiddleware is responsible for handles reverse proxy request to the upstream endpoint

func RequestIDMiddleware

func RequestIDMiddleware(header string) func(http.Handler) http.Handler

requestIDMiddleware is responsible for adding a request id if none found

func ResponseHeaderMiddleware

func ResponseHeaderMiddleware(headers map[string]string) func(http.Handler) http.Handler

ResponseHeaderMiddleware is responsible for adding response headers

func SecurityMiddleware

func SecurityMiddleware(
	logger *zap.Logger,
	allowedHosts []string,
	browserXSSFilter bool,
	contentSecurityPolicy string,
	contentTypeNosniff bool,
	frameDeny bool,
	sslRedirect bool,
	accessForbidden func(wrt http.ResponseWriter, req *http.Request) context.Context,
) func(http.Handler) http.Handler

SecurityMiddleware performs numerous security checks on the request

Types

This section is empty.

Jump to

Keyboard shortcuts

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