Files
warmbly/internal/api/middleware/handler.go
T

36 lines
1.5 KiB
Go

package middleware
import (
"github.com/warmbly/warmbly/internal/app/apikey"
"github.com/warmbly/warmbly/internal/app/idempotency"
"github.com/warmbly/warmbly/internal/app/oauth"
"github.com/warmbly/warmbly/internal/app/organization"
"github.com/warmbly/warmbly/internal/app/poollink"
"github.com/warmbly/warmbly/internal/app/ratelimit"
"github.com/warmbly/warmbly/internal/app/token"
"github.com/warmbly/warmbly/internal/infrastructure/cache"
)
type Handler struct {
TokenService token.TokenService
APIKeyService apikey.APIKeyService
IdempotencyService idempotency.Service
RateLimitService ratelimit.RateLimitService
OrganizationService organization.OrganizationService
// OAuthService validates OAuth 2.1 bearer access tokens (nil-safe: when
// unset, only JWT + API-key auth are accepted).
OAuthService *oauth.Service
// Cache backs the pre-login per-IP limiter, which cannot use
// RateLimitService because that one is keyed on a user id that does not
// exist yet.
Cache *cache.Cache
// PoolLinkService authenticates linked instances; nil-safe, routes answer 501.
PoolLinkService poollink.Service
// NodeCredentials verifies a fleet node's own credential on the node-only routes; nil admits none.
NodeCredentials NodeCredentialVerifier
// AgencyKeys authenticates agency API keys; nil admits none.
AgencyKeys *apikey.AgencyKeyService
// PortalClients holds a portal session to its agency's clients; nil lets a portal session reach no workspace.
PortalClients PortalClients
}