ecluse:ecluse-core
Safe HaskellNone
LanguageGHC2021

Ecluse.Core.Server.Pipeline.Shared

Description

Shared authentication, admission shedding, flight keys, and refusal handling. Route handlers keep their own response formats while sharing these policy decisions.

Synopsis

Edge authentication

edgeTokenMatches :: Maybe Secret -> Maybe ClientCredential -> Bool Source #

Match the configured inbound secret without content-dependent early exit. An unconfigured edge is open.

forwardedCredential :: MountBinding -> Request -> Maybe ClientCredential Source #

The client's credential, as the mount's credential mapping recovers it from the request headers.

unauthorisedMessage :: Text Source #

Report edge authentication failure without disclosing either token.

privateAuthorisationRefusal :: Maybe HelpMessage -> Refusal Source #

The fixed refusal shared by private metadata and artifact access failures.

Admission shed

withMetadataAdmission :: MonadUnliftIO m => ServeRuntime -> (ResponseHeaders -> m received) -> (MemoryTicket -> m a) -> (a -> m received) -> m received Source #

Acquire memory and CPU admission before metadata work. Answer after both release.

withListingAdmission :: MonadUnliftIO m => ServeRuntime -> (ResponseHeaders -> m received) -> (MemoryTicket -> m response) -> (response -> m received) -> m received Source #

Write after CPU admission releases, while the memory ticket still covers the response body.

shedStatus :: Status Source #

Use 503 to report server admission capacity, without implying a client rate limit.

shedMessage :: Text Source #

The body every read-path shed answers with, so the three handlers say one thing.

shedRetryAfter :: Header Source #

The shed retry delay, rounded down to whole seconds from admissionWaitMicros.

retryAfterHeaders :: Maybe RetryAfter -> ResponseHeaders Source #

Emit Retry-After only when a decision supplies a delay.

upstreamCooling :: RetryAfter -> ServeDecision Source #

A public authority that supplies a positive retry delay.

Shared work

flightOf :: CacheKey -> FlightKey Source #

The flight that the shared fetch or render behind a cache key runs under: the key's store and identity.

First-party refusals

firstPartyRule :: RuleName Source #

Use one rule label for first-party refusals across read paths.

Integrity-floor rejections

integrityMissing :: ServeDecision Source #

A public version with no integrity digest.

integrityBelowFloor :: ServeDecision Source #

A public version whose digest is weaker than the configured minimum.

trustedIntegrityMissing :: ServeDecision Source #

A private version with no integrity digest.

trustedIntegrityBelowFloor :: ServeDecision Source #

A private version whose digest is weaker than the configured trusted minimum.