Documentation
¶
Index ¶
- Constants
- func BearerToken(headers map[string][]string) string
- func BindJSON[Req any](ctx *apptheory.Context) (Req, error)
- func FirstHeaderValue(headers map[string][]string, key string) string
- func FirstQueryValue(query map[string][]string, key string) string
- func ParseJSON(ctx *apptheory.Context, dest any) error
- func SourceIP(ctx *apptheory.Context) string
- func SourceRateLimitIdentifier(ctx *apptheory.Context, prefix string) string
- func SourceRateLimitMetadata(ctx *apptheory.Context) map[string]string
- type TrustedSourceInfo
Constants ¶
const ContextKeyTrustedSource = "httpx.trusted_source"
ContextKeyTrustedSource is the AppTheory context key used when auth middleware has already captured trusted source provenance for downstream audit/rate-limit code.
Variables ¶
This section is empty.
Functions ¶
func BearerToken ¶
func BindJSON ¶ added in v0.4.0
BindJSON uses AppTheory typed request binding for JSON bodies while preserving host's existing ParseJSON request-size and error semantics.
func SourceIP ¶ added in v0.4.0
SourceIP returns the trusted provider-derived source IP convenience value.
func SourceRateLimitIdentifier ¶ added in v0.4.0
SourceRateLimitIdentifier returns a stable rate-limit identifier for callers without a stronger authenticated identity. The identifier is derived only from trusted provider context and falls back to a shared unknown bucket when provider source metadata is unavailable or invalid.
func SourceRateLimitMetadata ¶ added in v0.4.0
SourceRateLimitMetadata returns safe source metadata for rate-limit audit rows. It intentionally excludes the raw source IP; audit logs may store the raw provider-derived IP, but rate-limit rows use a fingerprint only.
Types ¶
type TrustedSourceInfo ¶ added in v0.4.0
TrustedSourceInfo is the sanitized, provider-derived source metadata host uses for audit and rate-limit context. It deliberately comes from AppTheory's SourceProvenance API rather than Forwarded/X-Forwarded-* headers.
func SetTrustedSource ¶ added in v0.4.0
func SetTrustedSource(ctx *apptheory.Context) TrustedSourceInfo
SetTrustedSource stores trusted source metadata on the AppTheory context for downstream auth/audit code. The metadata is still derived only from AppTheory's provider context.
func TrustedSource ¶ added in v0.4.0
func TrustedSource(ctx *apptheory.Context) TrustedSourceInfo
TrustedSource returns provider-derived source metadata from AppTheory. It does not parse or trust client-controlled forwarding headers.
func TrustedSourceFromContext ¶ added in v0.4.0
func TrustedSourceFromContext(ctx *apptheory.Context) TrustedSourceInfo
TrustedSourceFromContext returns previously captured trusted source metadata when present, falling back to AppTheory provider context extraction.
func (TrustedSourceInfo) Fingerprint ¶ added in v0.4.0
func (s TrustedSourceInfo) Fingerprint() string
Fingerprint returns a non-secret, deterministic fingerprint for source-IP based rate-limit keys so DynamoDB partition keys do not contain raw IPs.