httpctx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package httpctx provides shared helpers for extracting authentication context from gin-based HTTP handlers.

Both the native AgentBox API and the E2B-compatible API use oapi-codegen's strict server mode, which passes *gin.Context directly as context.Context. These helpers safely extract AuthInfo regardless of whether the context has been wrapped by context.WithValue.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthFrom

func AuthFrom(ctx context.Context) domain.AuthInfo

AuthFrom extracts domain.AuthInfo from the context.

It first tries a direct *gin.Context type assertion (fast path when the context has not been wrapped). If that fails, it uses ctx.Value("auth") which traverses through any context.WithValue layers and reaches the underlying gin.Context's key store.

func GinFromCtx

func GinFromCtx(ctx context.Context) *gin.Context

GinFromCtx extracts the *gin.Context from a context.Context. Returns nil if the context is not or does not wrap a *gin.Context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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