middleware

package
v0.0.0-...-af5d6c7 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthMiddleware

func BasicAuthMiddleware() gin.HandlerFunc

BasicAuthMiddleware implements HTTP Basic authentication for system credentials

func LastInvalidatedAt

func LastInvalidatedAt(systemKey string) time.Time

LastInvalidatedAt returns the most recent invalidation time for the given system_key, or the zero time if none was ever recorded.

func StartAuthInvalidator

func StartAuthInvalidator(ctx context.Context)

StartAuthInvalidator subscribes to the cross-service auth invalidation channel and purges every cached credential entry for a system as soon as backend signals the change. Without this hook the cache naturally expires within SystemAuthCacheTTL (default 10 minutes); the bus makes the propagation sub-second.

The subscriber runs in its own goroutine and stops when ctx is done. A Redis outage logs a warning and disables the bus — natural TTL expiration still catches up with the change eventually.

func WebhookAuthMiddleware

func WebhookAuthMiddleware() gin.HandlerFunc

WebhookAuthMiddleware validates the Bearer token in the Authorization header against ALERTING_HISTORY_WEBHOOK_SECRET. If the secret is not configured, the endpoint rejects all requests to prevent accidental open access.

Types

This section is empty.

Jump to

Keyboard shortcuts

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