graphql

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package graphql provides GraphQL execution engine

Package graphql provides GraphQL resolver implementations

Package graphql provides GraphQL API support for AegisGate

Package graphql provides GraphQL subscription support

Package graphql provides GraphQL API support for AegisGate

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetComplexityLimit

func GetComplexityLimit(ctx context.Context) int

GetComplexityLimit gets complexity limit from context

func GetDepthLimit

func GetDepthLimit(ctx context.Context) int

GetDepthLimit gets depth limit from context

func WithComplexityLimit

func WithComplexityLimit(ctx context.Context, limit int) context.Context

WithComplexityLimit adds complexity limit to context

func WithDepthLimit

func WithDepthLimit(ctx context.Context, limit int) context.Context

WithDepthLimit adds depth limit to context

func WithRequestInfo

func WithRequestInfo(ctx context.Context, info *RequestInfo) context.Context

WithRequestInfo adds request info to context

Types

type AuthConfig

type AuthConfig struct {
	Provider           string          `json:"provider"`
	SessionTimeout     int             `json:"session_timeout"`
	MaxSessionsPerUser int             `json:"max_sessions_per_user"`
	RequireMFA         bool            `json:"require_mfa"`
	MFAMethods         []string        `json:"mfa_methods"`
	PasswordPolicy     *PasswordPolicy `json:"password_policy"`
	LoginAttempts      int             `json:"login_attempts"`
	LockoutDuration    int             `json:"lockout_duration"`
	Providers          []string        `json:"providers"`
}

AuthConfig represents authentication configuration

type AuthProvider

type AuthProvider string

AuthProvider represents authentication providers

type AuthResult

type AuthResult struct {
	Success      bool   `json:"success"`
	Token        string `json:"token"`
	RefreshToken string `json:"refreshToken"`
	ExpiresAt    Time   `json:"expiresAt"`
	User         *User  `json:"user"`
	Error        string `json:"error"`
}

AuthResult represents authentication result

type Certificate

type Certificate struct {
	ID           string   `json:"id"`
	Subject      string   `json:"subject"`
	Issuer       string   `json:"issuer"`
	SerialNumber string   `json:"serialNumber"`
	NotBefore    Time     `json:"notBefore"`
	NotAfter     Time     `json:"notAfter"`
	DNSNames     []string `json:"dnsNames"`
	Fingerprint  string   `json:"fingerprint"`
	IsCA         bool     `json:"isCA"`
	Status       string   `json:"status"`
}

Certificate represents a certificate

type CertificateFilter

type CertificateFilter struct {
	Subject    string
	Issuer     string
	Expiration *time.Time
}

CertificateFilter represents filter parameters for certificate queries

type ComplianceFinding

type ComplianceFinding struct {
	ID          string   `json:"id"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Severity    Severity `json:"severity"`
	Category    string   `json:"category"`
	Timestamp   Time     `json:"timestamp"`
}

ComplianceFinding represents a compliance finding

type ComplianceFindingConnection

type ComplianceFindingConnection struct {
	Edges      []FindingEdge `json:"edges"`
	PageInfo   PageInfo      `json:"page_info"`
	TotalCount int           `json:"total_count"`
}

ComplianceFindingConnection represents a paginated list of findings

type ComplianceFindingEdge

type ComplianceFindingEdge struct {
	Node   compliance.Finding `json:"node"`
	Cursor string             `json:"cursor"`
}

ComplianceFindingEdge represents an edge in compliance findings

type ComplianceReport

type ComplianceReport struct {
	ID        string               `json:"id"`
	Framework string               `json:"framework"`
	Timestamp time.Time            `json:"timestamp"`
	Status    string               `json:"status"`
	Summary   string               `json:"summary"`
	Findings  []compliance.Finding `json:"findings"`
}

ComplianceReport represents a compliance report

type ComplianceReportSummary

type ComplianceReportSummary struct {
	TotalChecks   int     `json:"totalChecks"`
	Passed        int     `json:"passed"`
	Failed        int     `json:"failed"`
	Warnings      int     `json:"warnings"`
	NotApplicable int     `json:"notApplicable"`
	Score         float64 `json:"score"`
}

ComplianceReportSummary represents compliance report summary

type ComplianceResult

type ComplianceResult struct {
	ID        string               `json:"id"`
	Framework string               `json:"framework"`
	Status    string               `json:"status"`
	Passed    bool                 `json:"passed"`
	Score     float64              `json:"score"`
	Timestamp time.Time            `json:"timestamp"`
	Findings  []compliance.Finding `json:"findings"`
}

ComplianceResult represents the result of a compliance check

type ComplianceStatus

type ComplianceStatus string

ComplianceStatus represents compliance check status

type ComplianceStatusSummary

type ComplianceStatusSummary struct {
	Overall    ComplianceStatus   `json:"overall"`
	Frameworks []*FrameworkStatus `json:"frameworks"`
	LastCheck  Time               `json:"lastCheck"`
}

ComplianceStatusSummary represents overall compliance status

type Config

type Config struct {
	Name  string
	Value interface{}
}

Config represents a configuration

type ConfigError

type ConfigError struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

ConfigError represents config error

type ConfigInput

type ConfigInput struct {
	Name  string
	Value interface{}
}

ConfigInput represents input for configuring modules

type ConfigValidationResult

type ConfigValidationResult struct {
	Valid  bool           `json:"valid"`
	Errors []*ConfigError `json:"errors"`
}

ConfigValidationResult represents config validation result

type CounterMetric

type CounterMetric struct {
	Name   string                 `json:"name"`
	Value  int64                  `json:"value"`
	Labels map[string]interface{} `json:"labels"`
}

CounterMetric represents counter metric

type CreateUserInput

type CreateUserInput struct {
	Username string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"password"`
	Role     Role   `json:"role"`
}

CreateUserInput represents create user input

type DashboardData

type DashboardData struct {
	TotalRequests   int64   `json:"total_requests"`
	BlockedRequests int64   `json:"blocked_requests"`
	ActiveUsers     int     `json:"active_users"`
	ComplianceScore float64 `json:"compliance_score"`
}

DashboardData represents dashboard data for the UI

type DashboardStats

type DashboardStats struct {
	TotalRequests     int64   `json:"totalRequests"`
	BlockedRequests   int64   `json:"blockedRequests"`
	ActiveUsers       int     `json:"activeUsers"`
	ActiveConnections int     `json:"activeConnections"`
	Uptime            float64 `json:"uptime"`
}

DashboardStats represents dashboard statistics

type Error

type Error struct {
	Message    string                 `json:"message"`
	Locations  []Location             `json:"locations,omitempty"`
	Path       []interface{}          `json:"path,omitempty"`
	Extensions map[string]interface{} `json:"extensions,omitempty"`
}

Error represents a GraphQL error

type EventHandler

type EventHandler func(ctx context.Context, event *SubscriptionEvent)

EventHandler is a function that handles events

type Executor

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

Executor handles GraphQL query execution

func NewExecutor

func NewExecutor(resolver *Resolver) *Executor

NewExecutor creates a new executor

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, query string, variables map[string]interface{}) *Response

Execute executes a GraphQL query

type FindingEdge

type FindingEdge struct {
	Node   compliance.Finding `json:"node"`
	Cursor string             `json:"cursor"`
}

FindingEdge represents an edge in the finding connection

type FindingFilter

type FindingFilter struct {
	Framework string
	Severity  string
	Category  string
}

FindingFilter represents filter parameters for compliance findings

type Framework

type Framework struct {
	ID            FrameworkType    `json:"id"`
	Name          string           `json:"name"`
	Description   string           `json:"description"`
	Version       string           `json:"version"`
	Status        ComplianceStatus `json:"status"`
	FindingsCount int              `json:"findingsCount"`
}

Framework represents a compliance framework

type FrameworkStatus

type FrameworkStatus struct {
	Framework FrameworkType    `json:"framework"`
	Status    ComplianceStatus `json:"status"`
	Score     float64          `json:"score"`
	LastCheck *Time            `json:"lastCheck"`
}

FrameworkStatus represents framework status

type FrameworkType

type FrameworkType string

FrameworkType represents compliance framework types

type GaugeMetric

type GaugeMetric struct {
	Name   string                 `json:"name"`
	Value  float64                `json:"value"`
	Labels map[string]interface{} `json:"labels"`
}

GaugeMetric represents gauge metric

type Handler

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

Handler handles HTTP requests for GraphQL

func NewHandler

func NewHandler(resolver *Resolver, authMgr *auth.Manager) *Handler

NewHandler creates a new GraphQL handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles HTTP requests

type Health

type Health struct {
	Status    string         `json:"status"`
	Checks    []*HealthCheck `json:"checks"`
	Timestamp Time           `json:"timestamp"`
}

Health represents health status

type HealthCheck

type HealthCheck struct {
	Name      string `json:"name"`
	Status    string `json:"status"`
	Message   string `json:"message"`
	Timestamp Time   `json:"timestamp"`
}

HealthCheck represents a health check

type License

type License struct {
	ID        string   `json:"id"`
	Type      string   `json:"type"`
	Valid     bool     `json:"valid"`
	ExpiresAt *Time    `json:"expiresAt"`
	Features  []string `json:"features"`
}

License represents a license

type Location

type Location struct {
	Line   int `json:"line"`
	Column int `json:"column"`
}

Location represents a location in GraphQL source

type LogLevel

type LogLevel string

LogLevel represents logging levels

type LoginInput

type LoginInput struct {
	Username string `json:"username"`
	Password string `json:"password"`
	MFACode  string `json:"mfaCode"`
}

LoginInput represents login input

type MTLSConfig

type MTLSConfig struct {
	Enabled          bool   `json:"enabled"`
	CertFile         string `json:"certFile"`
	KeyFile          string `json:"keyFile"`
	CACertFile       string `json:"caCertFile"`
	CAKeyFile        string `json:"caKeyFile"`
	ClientAuth       string `json:"clientAuth"`
	VerifyClientCert bool   `json:"verifyClientCert"`
}

MTLSConfig represents mTLS configuration

type MTLSStatus

type MTLSStatus struct {
	Enabled        bool   `json:"enabled"`
	CaCertFile     string `json:"ca_cert_file"`
	ClientCertFile string `json:"client_cert_file"`
}

MTLSStatus represents mTLS configuration status

type MetricSnapshot

type MetricSnapshot struct {
	Timestamp Time             `json:"timestamp"`
	Counters  []*CounterMetric `json:"counters"`
	Gauges    []*GaugeMetric   `json:"gauges"`
}

MetricSnapshot represents metrics snapshot

type MetricsSnapshot

type MetricsSnapshot struct {
	Timestamp       time.Time `json:"timestamp"`
	TotalRequests   int64     `json:"total_requests"`
	BlockedRequests int64     `json:"blocked_requests"`
	ActiveUsers     int       `json:"active_users"`
}

MetricsSnapshot represents a snapshot of system metrics

type Module

type Module struct {
	ID          string       `json:"id"`
	Name        string       `json:"name"`
	Version     string       `json:"version"`
	Description string       `json:"description"`
	Category    string       `json:"category"`
	Tier        ModuleTier   `json:"tier"`
	Status      ModuleStatus `json:"status"`
}

Module represents a module

type ModuleHealth

type ModuleHealth struct {
	Status    string `json:"status"`
	Message   string `json:"message"`
	LastCheck Time   `json:"lastCheck"`
}

ModuleHealth represents module health

type ModuleStatus

type ModuleStatus string

ModuleStatus represents module statuses

type ModuleTier

type ModuleTier string

ModuleTier represents module tiers

type PageInfo

type PageInfo struct {
	HasNextPage     bool   `json:"hasNextPage"`
	HasPreviousPage bool   `json:"hasPreviousPage"`
	StartCursor     string `json:"startCursor"`
	EndCursor       string `json:"endCursor"`
}

PageInfo represents page info

type Pagination

type Pagination struct {
	Offset int `json:"offset"`
	Limit  int `json:"limit"`
	Total  int `json:"total"`
}

Pagination represents pagination parameters

type PasswordPolicy

type PasswordPolicy struct {
	MinLength      int  `json:"min_length"`
	RequireUpper   bool `json:"require_upper"`
	RequireLower   bool `json:"require_lower"`
	RequireDigit   bool `json:"require_digit"`
	RequireSpecial bool `json:"require_special"`
	MaxAge         int  `json:"max_age"`
}

PasswordPolicy - local type for GraphQL

type Permission

type Permission string

Permission represents user permissions

type Provider

type Provider = sso.SSOProvider

sso.Provider - alias for sso.SSOProvider (the sso package uses SSOProvider)

type ProviderType

type ProviderType = sso.SSOProvider

sso.ProviderType - alias for sso.SSOProvider (used as provider type)

type ProxyConfig

type ProxyConfig struct {
	Enabled     bool   `json:"enabled"`
	BindAddress string `json:"bind_address"`
	Upstream    string `json:"upstream"`
	MaxBodySize int64  `json:"max_body_size"`
	Timeout     int    `json:"timeout"`
	RateLimit   int    `json:"rate_limit"`
	TLSEnabled  bool   `json:"tls_enabled"`
}

ProxyConfig represents proxy configuration

type ProxyConfigInput

type ProxyConfigInput struct {
	Enabled     bool
	BindAddress string
	Upstream    string
	RateLimit   int
}

ProxyConfigInput represents input for configuring the proxy

type ProxyHealth

type ProxyHealth struct {
	Status      string  `json:"status"`
	Uptime      float64 `json:"uptime"`
	MemoryUsage int64   `json:"memoryUsage"`
}

ProxyHealth represents proxy health

type ProxyStats

type ProxyStats struct {
	RequestsTotal     int64   `json:"requestsTotal"`
	RequestsBlocked   int64   `json:"requestsBlocked"`
	RequestsAllowed   int64   `json:"requestsAllowed"`
	BytesIn           int64   `json:"bytesIn"`
	BytesOut          int64   `json:"bytesOut"`
	ActiveConnections int     `json:"activeConnections"`
	AvgLatencyMs      float64 `json:"avgLatencyMs"`
}

ProxyStats represents proxy statistics

type RegistryStatus

type RegistryStatus struct {
	TotalModules   int               `json:"total_modules"`
	ActiveModules  int               `json:"active_modules"`
	HealthyModules int               `json:"healthy_modules"`
	ModuleStatuses map[string]string `json:"module_statuses"`
}

RegistryStatus represents the status of the module registry

type RequestInfo

type RequestInfo struct {
	StartTime time.Time
	RemoteIP  string
}

RequestInfo holds information about the current request

func GetRequestInfo

func GetRequestInfo(ctx context.Context) *RequestInfo

GetRequestInfo gets request info from context

type Resolver

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

Resolver handles GraphQL resolver functions

func NewResolver

func NewResolver(server *Server) *Resolver

NewResolver creates a new resolver

func (*Resolver) AuthConfig

func (r *Resolver) AuthConfig(ctx context.Context) (*AuthConfig, error)

AuthConfig resolves auth configuration

func (*Resolver) Certificates

func (r *Resolver) Certificates(ctx context.Context, args struct {
	Filter     *CertificateFilter
	Pagination *Pagination
}) ([]*Certificate, error)

Certificates resolves certificates

func (*Resolver) ComplianceFindings

func (r *Resolver) ComplianceFindings(ctx context.Context, args struct {
	Filter     *FindingFilter
	Pagination *Pagination
}) (*ComplianceFindingConnection, error)

ComplianceFindings resolves compliance findings

func (*Resolver) ComplianceFrameworks

func (r *Resolver) ComplianceFrameworks(ctx context.Context) ([]*Framework, error)

ComplianceFrameworks resolves compliance frameworks

func (*Resolver) ComplianceReport

func (r *Resolver) ComplianceReport(ctx context.Context, args struct {
	Framework compliance.Framework
	Period    *TimeRange
}) (*ComplianceReport, error)

ComplianceReport resolves a compliance report

func (*Resolver) ComplianceStatus

func (r *Resolver) ComplianceStatus(ctx context.Context) (*ComplianceStatusSummary, error)

ComplianceStatus resolves compliance status

func (*Resolver) CreateUser

func (r *Resolver) CreateUser(ctx context.Context, args struct{ Input *CreateUserInput }) (*User, error)

CreateUser resolves create user mutation

func (*Resolver) CreateWebhook

func (r *Resolver) CreateWebhook(ctx context.Context, args struct{ Input *WebhookInput }) (*Webhook, error)

CreateWebhook resolves create webhook mutation

func (*Resolver) CurrentUser

func (r *Resolver) CurrentUser(ctx context.Context) (*User, error)

CurrentUser resolves the current authenticated user

func (*Resolver) DashboardData

func (r *Resolver) DashboardData(ctx context.Context) (*DashboardData, error)

DashboardData resolves dashboard data

func (*Resolver) DeleteUser

func (r *Resolver) DeleteUser(ctx context.Context, args struct{ ID string }) (bool, error)

DeleteUser resolves delete user mutation

func (*Resolver) DeleteWebhook

func (r *Resolver) DeleteWebhook(ctx context.Context, args struct{ ID string }) (bool, error)

DeleteWebhook resolves delete webhook mutation

func (*Resolver) Execute

func (r *Resolver) Execute(ctx context.Context, query string, variables map[string]interface{}) *Response

Execute executes a GraphQL query

func (*Resolver) Health

func (r *Resolver) Health(ctx context.Context) (*Health, error)

Health resolves health status

func (*Resolver) Login

func (r *Resolver) Login(ctx context.Context, args struct{ Input *LoginInput }) (*AuthResult, error)

Login resolves login mutation

func (*Resolver) Logout

func (r *Resolver) Logout(ctx context.Context) (bool, error)

Logout resolves logout mutation

func (*Resolver) Module

func (r *Resolver) Module(ctx context.Context, args struct{ ID string }) (*Module, error)

Module resolves a single module

func (*Resolver) Modules

func (r *Resolver) Modules(ctx context.Context) ([]*Module, error)

Modules resolves modules

func (*Resolver) ProxyConfig

func (r *Resolver) ProxyConfig(ctx context.Context) (*ProxyConfig, error)

ProxyConfig resolves proxy configuration

func (*Resolver) ProxyEnabled

func (r *Resolver) ProxyEnabled(ctx context.Context) (bool, error)

ProxyEnabled resolves whether proxy is enabled

func (*Resolver) ProxyHealth

func (r *Resolver) ProxyHealth(ctx context.Context) (*ProxyHealth, error)

ProxyHealth resolves proxy health

func (*Resolver) ProxyStats

func (r *Resolver) ProxyStats(ctx context.Context) (*ProxyStats, error)

ProxyStats resolves proxy statistics

func (*Resolver) RegistryStatus

func (r *Resolver) RegistryStatus(ctx context.Context) (*RegistryStatus, error)

RegistryStatus resolves registry status

func (*Resolver) RunComplianceCheck

func (r *Resolver) RunComplianceCheck(ctx context.Context, args struct {
	Framework compliance.Framework
}) (*ComplianceResult, error)

RunComplianceCheck resolves run compliance check mutation

func (*Resolver) SIEMConfig

func (r *Resolver) SIEMConfig(ctx context.Context) (*SIEMConfig, error)

SIEMConfig resolves SIEM configuration

func (*Resolver) SIEMEvents

func (r *Resolver) SIEMEvents(ctx context.Context, args struct {
	Filter     *SIEMEventFilter
	Pagination *Pagination
}) ([]*SIEMEvent, error)

SIEMEvents resolves SIEM events

func (*Resolver) SIEMStats

func (r *Resolver) SIEMStats(ctx context.Context) (*SIEMStats, error)

SIEMStats resolves SIEM statistics

func (*Resolver) SSOProvider

func (r *Resolver) SSOProvider(ctx context.Context, args struct{ ID string }) (*SSOProvider, error)

SSOProvider resolves a single SSO provider

func (*Resolver) SSOProviders

func (r *Resolver) SSOProviders(ctx context.Context) ([]*SSOProvider, error)

SSOProviders resolves SSO providers

func (*Resolver) Sessions

func (r *Resolver) Sessions(ctx context.Context, args struct {
	UserID     *string
	Pagination *Pagination
}) ([]*Session, error)

Sessions resolves sessions

func (*Resolver) UpdateUser

func (r *Resolver) UpdateUser(ctx context.Context, args struct {
	ID    string
	Input *UpdateUserInput
}) (*User, error)

UpdateUser resolves update user mutation

func (*Resolver) UpdateWebhook

func (r *Resolver) UpdateWebhook(ctx context.Context, args struct {
	ID    string
	Input *WebhookInput
}) (*Webhook, error)

UpdateWebhook resolves update webhook mutation

func (*Resolver) Uptime

func (r *Resolver) Uptime(ctx context.Context) (float64, error)

Uptime resolves uptime

func (*Resolver) User

func (r *Resolver) User(ctx context.Context, args struct{ ID string }) (*User, error)

User resolves a single user

func (*Resolver) Users

func (r *Resolver) Users(ctx context.Context, args struct {
	Filter     *UserFilter
	Pagination *Pagination
}) ([]*User, error)

Users resolves the users query

func (*Resolver) Violation

func (r *Resolver) Violation(ctx context.Context, args struct{ ID string }) (*Violation, error)

Violation resolves a single violation

func (*Resolver) Violations

func (r *Resolver) Violations(ctx context.Context, args struct {
	Filter     *ViolationFilter
	Pagination *Pagination
}) ([]*Violation, error)

Violations resolves violations

func (*Resolver) Webhook

func (r *Resolver) Webhook(ctx context.Context, args struct{ ID string }) (*Webhook, error)

Webhook resolves a single webhook

func (*Resolver) WebhookStats

func (r *Resolver) WebhookStats(ctx context.Context) (*WebhookStats, error)

WebhookStats resolves webhook statistics

func (*Resolver) Webhooks

func (r *Resolver) Webhooks(ctx context.Context, args struct {
	Filter     *WebhookFilter
	Pagination *Pagination
}) ([]*Webhook, error)

Webhooks resolves webhooks

type Response

type Response struct {
	Data       interface{}            `json:"data,omitempty"`
	Errors     []*Error               `json:"errors,omitempty"`
	Extensions map[string]interface{} `json:"extensions,omitempty"`
}

Response represents a GraphQL response

type Role

type Role string

Role represents user roles

type SIEMConfig

type SIEMConfig struct {
	Enabled    bool   `json:"enabled"`
	Platform   string `json:"platform"`
	Endpoint   string `json:"endpoint"`
	Format     string `json:"format"`
	BufferSize int    `json:"buffer_size"`
}

SIEMConfig represents SIEM configuration

type SIEMEvent

type SIEMEvent struct {
	ID         string                 `json:"id"`
	Timestamp  Time                   `json:"timestamp"`
	Source     string                 `json:"source"`
	Category   string                 `json:"category"`
	Severity   Severity               `json:"severity"`
	Message    string                 `json:"message"`
	Attributes map[string]interface{} `json:"attributes"`
}

SIEMEvent represents SIEM event

type SIEMEventFilter

type SIEMEventFilter struct {
	Source    string
	Category  string
	Severity  string
	StartTime *time.Time
	EndTime   *time.Time
}

SIEMEventFilter represents filter parameters for SIEM events

type SIEMStats

type SIEMStats = Stats

SIEMStats is an alias for Stats (for resolver.go compatibility)

type SSOProvider

type SSOProvider struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

SSOProvider - local type for GraphQL (not to be confused with sso.SSOProvider)

type SSOProviderType

type SSOProviderType = sso.SSOProvider

sso.SSOProviderType - alias for sso.SSOProvider

type SecurityEvent

type SecurityEvent struct {
	ID        string `json:"id"`
	Type      string `json:"type"`
	Severity  string `json:"severity"`
	Message   string `json:"message"`
	Timestamp string `json:"timestamp"`
}

SecurityEvent represents a security event for subscriptions

type Server

type Server struct {
	http.Server
	// contains filtered or unexported fields
}

Server represents the GraphQL server

func NewServer

func NewServer(cfg *ServerConfig, logger *slog.Logger) *Server

NewServer creates a new GraphQL server

func (*Server) RegisterModules

func (s *Server) RegisterModules(
	authMgr *auth.Manager,
	ssoMgr *sso.Manager,
	complianceMgr *compliance.Manager,
	proxySrv *proxy.Proxy,
	siemMgr *siem.Manager,
	webhookMgr *webhook.Manager,
	tlsMgr *tls.Manager,
	coreReg *core.Registry,
	metricsMgr *metrics.Manager,
)

RegisterModules registers all AegisGate modules with the GraphQL server

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler

func (*Server) Start

func (s *Server) Start() error

Start starts the GraphQL server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the GraphQL server

type ServerConfig

type ServerConfig struct {
	Enabled         bool          `yaml:"enabled"`
	ListenAddress   string        `yaml:"listen_address"`
	Port            int           `yaml:"port"`
	Playground      bool          `yaml:"playground"`
	DepthLimit      int           `yaml:"depth_limit"`
	ComplexityLimit int           `yaml:"complexity_limit"`
	Timeout         time.Duration `yaml:"timeout"`
}

ServerConfig holds GraphQL server configuration

func DefaultServerConfig

func DefaultServerConfig() *ServerConfig

DefaultServerConfig returns default configuration

type Session

type Session struct {
	ID        string `json:"id"`
	UserID    string `json:"userId"`
	Token     string `json:"token"`
	ExpiresAt Time   `json:"expiresAt"`
	CreatedAt Time   `json:"createdAt"`
	IPAddress string `json:"ipAddress"`
	UserAgent string `json:"userAgent"`
}

Session represents a user session

type Severity

type Severity string

Severity represents finding severity levels

type Stats

type Stats struct {
	EventsSent     int64 `json:"events_sent"`
	EventsReceived int64 `json:"events_received"`
	EventsFailed   int64 `json:"events_failed"`
	BytesSent      int64 `json:"bytes_sent"`
}

siem.Stats - create a stats type for SIEM (the package doesn't have this)

type Subscription

type Subscription struct {
	ID        string
	Query     string
	Variables map[string]interface{}
	Operation string
	Context   context.Context
	Cancel    context.CancelFunc
	Events    chan *SubscriptionEvent
	StartedAt time.Time
}

Subscription represents an active subscription

type SubscriptionEvent

type SubscriptionEvent struct {
	ID        string                 `json:"id"`
	Type      string                 `json:"type"`
	Payload   map[string]interface{} `json:"payload"`
	Timestamp time.Time              `json:"timestamp"`
}

SubscriptionEvent represents a subscription event

type SubscriptionManager

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

SubscriptionManager manages GraphQL subscriptions

func NewSubscriptionManager

func NewSubscriptionManager() *SubscriptionManager

NewSubscriptionManager creates a new subscription manager

func (*SubscriptionManager) Cleanup

func (sm *SubscriptionManager) Cleanup()

Cleanup removes all subscriptions

func (*SubscriptionManager) Count

func (sm *SubscriptionManager) Count() int

Count returns the number of active subscriptions

func (*SubscriptionManager) Publish

func (sm *SubscriptionManager) Publish(eventType string, payload map[string]interface{})

Publish publishes an event to all matching subscriptions

func (*SubscriptionManager) PublishCompliance

func (sm *SubscriptionManager) PublishCompliance(result *ComplianceResult)

PublishCompliance publishes compliance result

func (*SubscriptionManager) PublishHealth

func (sm *SubscriptionManager) PublishHealth(health *Health)

PublishHealth publishes health status change

func (*SubscriptionManager) PublishMetrics

func (sm *SubscriptionManager) PublishMetrics(snapshot *MetricsSnapshot)

PublishMetrics publishes metrics update

func (*SubscriptionManager) PublishSIEMEvent

func (sm *SubscriptionManager) PublishSIEMEvent(event *SIEMEvent)

PublishSIEMEvent publishes a SIEM event

func (*SubscriptionManager) PublishSecurityEvent

func (sm *SubscriptionManager) PublishSecurityEvent(event *SecurityEvent)

PublishSecurityEvent publishes a security event

func (*SubscriptionManager) PublishViolation

func (sm *SubscriptionManager) PublishViolation(violation *Violation)

PublishViolation publishes a violation event

func (*SubscriptionManager) RegisterHandler

func (sm *SubscriptionManager) RegisterHandler(eventType string, handler EventHandler)

RegisterHandler registers an event handler for a subscription type

func (*SubscriptionManager) RegisterSubscriptions

func (sm *SubscriptionManager) RegisterSubscriptions()

RegisterSubscriptions registers default subscription handlers

func (*SubscriptionManager) Subscribe

func (sm *SubscriptionManager) Subscribe(ctx context.Context, query string, variables map[string]interface{}, operation string) (*Subscription, error)

Subscribe creates a new subscription

func (*SubscriptionManager) Unsubscribe

func (sm *SubscriptionManager) Unsubscribe(id string)

Unsubscribe removes a subscription

type TLSConfig

type TLSConfig struct {
	Enabled      bool     `json:"enabled"`
	MinVersion   string   `json:"minVersion"`
	MaxVersion   string   `json:"maxVersion"`
	CipherSuites []string `json:"cipherSuites"`
	CertFile     string   `json:"certFile"`
	KeyFile      string   `json:"keyFile"`
	AutoGenerate bool     `json:"autoGenerate"`
}

TLSConfig represents TLS configuration

type TestResult

type TestResult struct {
	Passed  bool
	Message string
}

TestResult represents a test result (for test configuration)

type Time

type Time time.Time

Time is a custom scalar for time

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type TimeRange

type TimeRange struct {
	Start time.Time
	End   time.Time
}

TimeRange represents a time range for queries

type UpdateUserInput

type UpdateUserInput struct {
	Email   string
	Role    string
	Enabled bool
}

UpdateUserInput represents input for updating a user

type User

type User struct {
	ID        string `json:"id"`
	Username  string `json:"username"`
	Email     string `json:"email"`
	Role      Role   `json:"role"`
	Enabled   bool   `json:"enabled"`
	LastLogin *Time  `json:"lastLogin"`
	CreatedAt Time   `json:"createdAt"`
	UpdatedAt Time   `json:"updatedAt"`
}

User represents a user

type UserFilter

type UserFilter struct {
	Role     string
	Provider string
	Email    string
	Search   string
}

UserFilter represents filter parameters for user queries

type Violation

type Violation struct {
	ID        string        `json:"id"`
	Type      ViolationType `json:"type"`
	Severity  Severity      `json:"severity"`
	Message   string        `json:"message"`
	Timestamp Time          `json:"timestamp"`
	ClientIP  string        `json:"clientIP"`
	Method    string        `json:"method"`
	Path      string        `json:"path"`
	Blocked   bool          `json:"blocked"`
}

Violation represents a proxy violation

type ViolationFilter

type ViolationFilter struct {
	Severity  string
	Type      string
	ClientIP  string
	Path      string
	StartDate *time.Time
	EndDate   *time.Time
}

ViolationFilter represents filter parameters for violation queries

type ViolationType

type ViolationType string

ViolationType represents proxy violation types

type WebSocketHandler

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

WebSocketHandler handles GraphQL WebSocket connections

func NewWebSocketHandler

func NewWebSocketHandler(manager *SubscriptionManager) *WebSocketHandler

NewWebSocketHandler creates a new WebSocket handler

func (*WebSocketHandler) HandleWebSocket

func (wh *WebSocketHandler) HandleWebSocket(w http.ResponseWriter, r *http.Request)

HandleWebSocket handles WebSocket connection

func (*WebSocketHandler) SetAuthFunc

func (wh *WebSocketHandler) SetAuthFunc(f func(http.Header) (context.Context, error))

SetAuthFunc sets authentication function

type WebSocketMessage

type WebSocketMessage struct {
	Type    string `json:"type"`
	ID      string `json:"id,omitempty"`
	Payload string `json:"payload,omitempty"`
}

WebSocketMessage represents a WebSocket message

type WebSocketUpgrader

type WebSocketUpgrader struct {
	ReadBufferSize  int
	WriteBufferSize int
	CheckOrigin     func(r *http.Request) bool
}

WebSocketUpgrader upgrades HTTP to WebSocket

func DefaultUpgrader

func DefaultUpgrader() *WebSocketUpgrader

DefaultUpgrader returns default WebSocket upgrader

type Webhook

type Webhook struct {
	ID        string   `json:"id"`
	Name      string   `json:"name"`
	URL       string   `json:"url"`
	Events    []string `json:"events"`
	Enabled   bool     `json:"enabled"`
	CreatedAt Time     `json:"createdAt"`
	UpdatedAt Time     `json:"updatedAt"`
}

Webhook represents a webhook

type WebhookFilter

type WebhookFilter struct {
	Enabled   *bool
	Name      string
	EventType string
}

WebhookFilter represents filter parameters for webhooks

type WebhookInput

type WebhookInput struct {
	Name    string
	URL     string
	Events  []string
	Enabled bool
}

WebhookInput represents input for creating/updating a webhook

type WebhookStats

type WebhookStats struct {
	TotalDeliveries int64     `json:"total_deliveries"`
	SuccessCount    int64     `json:"success_count"`
	FailureCount    int64     `json:"failure_count"`
	LastDelivery    time.Time `json:"last_delivery"`
	LastError       string    `json:"last_error"`
}

WebhookStats represents webhook statistics

Jump to

Keyboard shortcuts

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