resolver

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RouteChatCompletions = "/v1/chat/completions"
	RouteMessages        = "/v1/messages"
	RouteResponses       = "/v1/responses"
)
View Source
const HeaderAPIKey = "X-AG-API-Key" // #nosec G101 -- HTTP header name, not a credential
View Source
const HeaderGatewaySlug = "X-AG-Gateway-Slug"
View Source
const HeaderPlaygroundToken = "X-AG-Playground-Token" // #nosec G101 -- HTTP header name, not a credential

HeaderPlaygroundToken carries a short-lived, server-minted JWT that lets the dashboard playground exercise a consumer route without that consumer's credentials. Minting requires SERVER_SECRET_KEY, so the trust boundary is the same as the admin API.

View Source
const ProxyRouteLocalsKey = "proxyRoute"

ProxyRouteLocalsKey stores the resolved ProxyRoute in fiber Locals so the proxy handler can reuse the parse done by the auth middleware.

Variables

View Source
var (
	ErrUnauthenticated = errors.New("unauthenticated")
	ErrForbidden       = errors.New("forbidden")
)
View Source
var ErrUnknownProxyPath = errors.New("no fixed proxy route matches the request path")

Functions

func WithResolvedGateway

func WithResolvedGateway(c *fiber.Ctx, r GatewayResolver) context.Context

WithResolvedGateway best-effort resolves the gateway addressed by the request (gateway-slug header or subdomain, per the configured discovery mode) and returns a context carrying it. On any resolution miss it returns the request context unchanged, so callers that can still operate without a pinned gateway keep working.

Types

type APIKeyIdentityResolver

type APIKeyIdentityResolver struct{}

func NewAPIKeyIdentityResolver

func NewAPIKeyIdentityResolver() *APIKeyIdentityResolver

func (*APIKeyIdentityResolver) Resolve

type ChainedIdentityResolver

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

func (ChainedIdentityResolver) Resolve

type GatewayResolver

type GatewayResolver interface {
	Resolve(c *fiber.Ctx) (*gatewaydomain.Gateway, error)
}

func NewGatewayResolver

func NewGatewayResolver(finder appgateway.Finder, mode, baseDomain string) GatewayResolver

func NewSubdomainGatewayResolver

func NewSubdomainGatewayResolver(finder appgateway.Finder, baseDomain string) GatewayResolver

type HeaderGatewayResolver

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

func (*HeaderGatewayResolver) Resolve

type IdentityResolver

type IdentityResolver interface {
	Resolve(c *fiber.Ctx, gw *gatewaydomain.Gateway, rc *appconsumer.RoutableConsumer) (*appauth.AuthContext, error)
}

type OAuth2IdentityResolver

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

func NewOAuth2IdentityResolver

func NewOAuth2IdentityResolver(verifier appauth.OAuth2Verifier) *OAuth2IdentityResolver

func (*OAuth2IdentityResolver) Resolve

type OIDCIdentityResolver

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

func NewOIDCIdentityResolver

func NewOIDCIdentityResolver(finder appauth.OIDCFinder, verifier appauth.OIDCVerifier) *OIDCIdentityResolver

func (*OIDCIdentityResolver) Resolve

type PlaygroundIdentityResolver

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

PlaygroundIdentityResolver authenticates playground tokens: JWTs signed with the server secret, tagged with purpose "playground" and bound to a single consumer slug.

func NewPlaygroundIdentityResolver

func NewPlaygroundIdentityResolver(jwtManager jwt.Manager) *PlaygroundIdentityResolver

func (*PlaygroundIdentityResolver) Resolve

type ProxyRoute

type ProxyRoute struct {
	ConsumerSlug string
	SourceFormat adapter.Format
	Rest         string
}

ProxyRoute is the result of parsing a proxy request path of the form /{consumer_slug}/{fixed route}, where the fixed route determines the payload format the client speaks.

func ResolveProxyPath

func ResolveProxyPath(path string) (ProxyRoute, error)

type SubdomainGatewayResolver

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

func (*SubdomainGatewayResolver) Resolve

Jump to

Keyboard shortcuts

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