middleware

package
v1.15.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEnvProxyMiddlewareWithParam

func NewEnvProxyMiddlewareWithParam(localID, paramName string, resolver EnvResolver, envService *services.EnvironmentService, authValidator AuthValidator) gin.HandlerFunc

NewEnvProxyMiddlewareWithParam creates middleware that proxies requests to remote environments. - localID: the ID representing the local environment (requests to this ID are not proxied) - paramName: the URL parameter name containing the environment ID (e.g., "id") - resolver: function to resolve environment ID to connection details - envService: environment service for additional lookups - authValidator: function to validate authentication before proxying (required for security)

Types

type ApiKeyValidator

type ApiKeyValidator interface {
	ValidateApiKey(ctx context.Context, rawKey string) (*models.User, error)
}

type AuthMiddleware

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

func NewAuthMiddleware

func NewAuthMiddleware(authService *services.AuthService, cfg *config.Config) *AuthMiddleware

func (*AuthMiddleware) Add

func (m *AuthMiddleware) Add() gin.HandlerFunc

func (*AuthMiddleware) WithAdminNotRequired

func (m *AuthMiddleware) WithAdminNotRequired() *AuthMiddleware

func (*AuthMiddleware) WithApiKeyValidator

func (m *AuthMiddleware) WithApiKeyValidator(validator ApiKeyValidator) *AuthMiddleware

type AuthOptions

type AuthOptions struct {
	AdminRequired   bool
	SuccessOptional bool
}

type AuthValidator

type AuthValidator func(ctx context.Context, c *gin.Context) bool

AuthValidator validates authentication for a request. Returns true if the request is authenticated, false otherwise.

type CORSMiddleware

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

func NewCORSMiddleware

func NewCORSMiddleware(cfg *config.Config) *CORSMiddleware

func (*CORSMiddleware) Add

func (m *CORSMiddleware) Add() gin.HandlerFunc

type EnvResolver

type EnvResolver func(ctx context.Context, id string) (string, *string, bool, error)

EnvResolver resolves an environment ID to its connection details. Returns: apiURL, accessToken, enabled, error

type EnvironmentMiddleware

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

EnvironmentMiddleware proxies requests for remote environments to their respective agents.

func (*EnvironmentMiddleware) Handle

func (m *EnvironmentMiddleware) Handle(c *gin.Context)

Handle is the main middleware handler.

Jump to

Keyboard shortcuts

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