Documentation
¶
Index ¶
- func ExtractAuthSchemeFromSpec(doc *openapi3.T) (string, string, string)
- func ExtractAuthSchemeFromSpecWithContent(doc *openapi3.T, rawSpecContent string) (string, string, string)
- func WithAuthContext(ctx context.Context, authCtx *AuthContext) context.Context
- type AuthContext
- type SecureAuthProvider
- type SecureHTTPClientWrapper
- type SecureRequestModifier
- type SecureRoundTripper
- type StateManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractAuthSchemeFromSpec ¶
ExtractAuthSchemeFromSpec extracts authentication scheme information from the OpenAPI spec
func ExtractAuthSchemeFromSpecWithContent ¶
func ExtractAuthSchemeFromSpecWithContent(doc *openapi3.T, rawSpecContent string) (string, string, string)
ExtractAuthSchemeFromSpecWithContent extracts authentication scheme information from the OpenAPI spec and preserves original header casing from raw spec content if provided
func WithAuthContext ¶
func WithAuthContext(ctx context.Context, authCtx *AuthContext) context.Context
Types ¶
type AuthContext ¶
type AuthContext struct {
Token string
AuthType string
Endpoint string
SpecParamName string // OpenAPI spec-defined parameter name for API keys
ApiHost string // API host from OpenAPI spec servers
HostHeaders map[string]string // Host headers extracted from OpenAPI spec parameters
// Store original HTTP request for header access during tool execution
OriginalRequest *http.Request
// contains filtered or unexported fields
}
func CreateAuthContext ¶
func CreateAuthContext(r *http.Request, doc *openapi3.T, spec *models.OpenAPISpec) *AuthContext
func CreateAuthContextWithToolArgs ¶
func CreateAuthContextWithToolArgs(r *http.Request, doc *openapi3.T, spec *models.OpenAPISpec, toolArgs map[string]any) *AuthContext
CreateAuthContextWithToolArgs creates authentication context with support for tool-level arguments Tool arguments take highest priority and can override database/header authentication
func FromContext ¶
func FromContext(ctx context.Context) (*AuthContext, bool)
type SecureAuthProvider ¶
type SecureAuthProvider interface {
// GetAuthHeaders returns authentication headers for the given context
GetAuthHeaders(ctx context.Context) map[string]string
// GetAuthQueryParams returns authentication query parameters for the given context
GetAuthQueryParams(ctx context.Context) map[string]string
}
SecureAuthProvider provides authentication without global state mutation
func NewSecureAuthProvider ¶
func NewSecureAuthProvider() SecureAuthProvider
NewSecureAuthProvider creates a new secure authentication provider
type SecureHTTPClientWrapper ¶
type SecureHTTPClientWrapper struct {
// contains filtered or unexported fields
}
SecureHTTPClientWrapper wraps HTTP requests with authentication without global state mutation
func NewSecureHTTPClientWrapper ¶
func NewSecureHTTPClientWrapper(client *http.Client, provider SecureAuthProvider) *SecureHTTPClientWrapper
NewSecureHTTPClientWrapper creates a new secure HTTP client wrapper
type SecureRequestModifier ¶
type SecureRequestModifier struct {
// contains filtered or unexported fields
}
SecureRequestModifier modifies HTTP requests with authentication without using environment variables
func NewSecureRequestModifier ¶
func NewSecureRequestModifier(provider SecureAuthProvider) *SecureRequestModifier
NewSecureRequestModifier creates a new secure request modifier
func (*SecureRequestModifier) ModifyRequest ¶
func (m *SecureRequestModifier) ModifyRequest(req *http.Request)
ModifyRequest adds authentication to an HTTP request using context
type SecureRoundTripper ¶
type SecureRoundTripper struct {
// contains filtered or unexported fields
}
RoundTrip implements http.RoundTripper for use as a transport
func NewSecureRoundTripper ¶
func NewSecureRoundTripper(base http.RoundTripper, provider SecureAuthProvider) *SecureRoundTripper
NewSecureRoundTripper creates a new secure round tripper
type StateManager ¶
type StateManager struct {
// contains filtered or unexported fields
}
func NewStateManager ¶
func NewStateManager() *StateManager
func (*StateManager) GetSpec ¶
func (sm *StateManager) GetSpec(endpoint string) (*models.OpenAPISpec, bool)
func (*StateManager) UpdateSpecs ¶
func (sm *StateManager) UpdateSpecs(specs []*models.OpenAPISpec)