custom

package
v3.1.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Overview

Package custom provides custom functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DispatchAlias

func DispatchAlias(ctx *gin.Context) bool

DispatchAlias executes a configured custom hook alias for requests that did not match a concrete route. It returns false when the request is not an alias.

func RequestHandler

func RequestHandler(cfgProvider configfx.Provider, logger *slog.Logger, redis rediscli.Client, validator oidcbearer.TokenValidator) gin.HandlerFunc

RequestHandler mirrors the original logic for executing custom Lua hooks. The validator may be nil when OIDC authentication is not configured.

func RequestHandlerWithNative

func RequestHandlerWithNative(
	cfgProvider configfx.Provider,
	logger *slog.Logger,
	redis rediscli.Client,
	validator oidcbearer.TokenValidator,
	nativeHooks *nativeHookIndex,
) gin.HandlerFunc

RequestHandlerWithNative executes native plugin hooks before falling back to the existing Lua custom hook implementation.

Types

type Handler

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

Handler registers custom Lua hook endpoint(s).

func New

func New(cfgProvider configfx.Provider, logger *slog.Logger, redis rediscli.Client, validator oidcbearer.TokenValidator, options ...Option) *Handler

New creates a Handler with explicit dependencies. The validator may be nil when OIDC authentication is not configured.

func (*Handler) Register

func (h *Handler) Register(r gin.IRouter)

Register registers the custom hook route on the given router.

type NativeHook

type NativeHook struct {
	Runner        NativeHookRunner
	BuildRequest  NativeHookRequestBuilder
	Descriptor    pluginapi.HookDescriptor
	QualifiedName string
	ModuleName    string
	ComponentName string
}

NativeHook binds one registered plugin hook to the custom HTTP handler.

type NativeHookCaller

type NativeHookCaller struct {
	Subject       string
	ClientID      string
	Authenticated bool
}

NativeHookCaller contains authenticated caller metadata for request building.

type NativeHookRequestBuilder

NativeHookRequestBuilder builds the public hook request after host validation.

type NativeHookRunner

type NativeHookRunner interface {
	ServeHook(context.Context, string, pluginapi.HookRequest) (pluginapi.HookResponse, error)
}

NativeHookRunner invokes one native plugin hook through the runtime boundary.

type Option

type Option func(*Handler)

Option customizes custom hook handler registration.

func WithNativeHooks

func WithNativeHooks(hooks []NativeHook) Option

WithNativeHooks registers native plugin hook bindings in the custom handler.

Jump to

Keyboard shortcuts

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