push

package
v2.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBasePath = "/_frame/queue"

DefaultBasePath is the reserved mux path for queue push delivery.

Variables

This section is empty.

Functions

func HTTPStatusFor

func HTTPStatusFor(err error) int

HTTPStatusFor maps processing errors to HTTP status codes for push delivery.

Types

type AuthMode

type AuthMode string

AuthMode is the push endpoint authentication mode.

const (
	AuthNone   AuthMode = "none"
	AuthBearer AuthMode = "bearer"
	AuthOIDC   AuthMode = "oidc"
)

func ParseAuthMode

func ParseAuthMode(s string) AuthMode

ParseAuthMode normalizes a config string to AuthMode.

type Authenticator

type Authenticator interface {
	Authenticate(r *http.Request) error
}

Authenticator validates push HTTP requests.

type BearerAuth

type BearerAuth struct {
	Token string
}

BearerAuth checks Authorization: Bearer <token> with constant-time compare.

func (BearerAuth) Authenticate

func (b BearerAuth) Authenticate(r *http.Request) error

type Config

type Config struct {
	BasePath     string
	Auth         Authenticator
	TrustClaims  bool
	AckPoison    bool
	MaxBodyBytes int64
	// HandlerTimeout bounds the delivery context. Zero means no timeout —
	// queue consumers process until the handler returns (background work).
	HandlerTimeout time.Duration
	// ProtocolOverride forces a codec; empty uses subscriber URL query or auto.
	ProtocolOverride string
}

Config configures the multiplexing push handler.

type Handler

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

Handler demultiplexes POST /{base}/{ref} to registered push subscribers.

func NewHandler

func NewHandler(lookup queue.PushLookup, cfg Config) *Handler

NewHandler builds a push multiplexing handler.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux)

Register mounts the handler on mux with a methodless path pattern.

func (*Handler) ServeHTTP

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

type NoneAuth

type NoneAuth struct{}

NoneAuth allows all requests (local / private mesh only).

func (NoneAuth) Authenticate

func (NoneAuth) Authenticate(_ *http.Request) error

type OIDCAuth

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

OIDCAuth validates Google OIDC bearer tokens for Cloud Tasks push.

func NewOIDCAuth

func NewOIDCAuth(ctx context.Context, cfg OIDCConfig) *OIDCAuth

NewOIDCAuth creates an OIDC authenticator and starts JWKS refresh.

func (*OIDCAuth) Authenticate

func (o *OIDCAuth) Authenticate(r *http.Request) error

func (*OIDCAuth) Stop

func (o *OIDCAuth) Stop()

Stop stops JWKS refresh.

type OIDCConfig

type OIDCConfig struct {
	Audience    string
	Issuers     []string
	JWKSURL     string
	JWKSRefresh time.Duration
}

OIDCConfig configures dedicated Google-oriented push OIDC validation.

func GoogleCloudTasksOIDCPreset

func GoogleCloudTasksOIDCPreset(audience string) OIDCConfig

GoogleCloudTasksOIDCPreset returns defaults for Cloud Tasks OIDC tokens.

Jump to

Keyboard shortcuts

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