Documentation
¶
Index ¶
- Constants
- func HashPassword(password string) (string, error)
- type HealthCheck
- type HealthChecker
- type HealthResponse
- type HealthStatus
- type RateLimiter
- type SecureAuthConfig
- type SecureLoginHandler
- type SecureTokenManager
- func (tm *SecureTokenManager) GenerateCSRFToken() (string, error)
- func (tm *SecureTokenManager) GenerateToken(username string) (string, error)
- func (tm *SecureTokenManager) RevokeToken(token string)
- func (tm *SecureTokenManager) ValidateCSRFToken(token string) bool
- func (tm *SecureTokenManager) ValidateToken(token string) (*TokenData, bool)
- type Server
- type SystemInfo
- type TokenData
Constants ¶
const (
// BearerPrefix is the prefix for Bearer tokens in Authorization header
BearerPrefix = "Bearer"
)
Variables ¶
This section is empty.
Functions ¶
func HashPassword ¶ added in v0.10.1
HashPassword generates a bcrypt hash of the password
Types ¶
type HealthCheck ¶ added in v0.10.1
type HealthCheck struct {
Name string `json:"name"`
Status HealthStatus `json:"status"`
Message string `json:"message,omitempty"`
LastChecked time.Time `json:"lastChecked"`
Duration time.Duration `json:"durationMs"`
}
HealthCheck represents a single health check
type HealthChecker ¶ added in v0.10.1
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker performs health checks
func NewHealthChecker ¶ added in v0.10.1
func NewHealthChecker(dockerProvider core.DockerProvider, version string) *HealthChecker
NewHealthChecker creates a new health checker
func (*HealthChecker) GetHealth ¶ added in v0.10.1
func (hc *HealthChecker) GetHealth() HealthResponse
GetHealth returns the current health status
func (*HealthChecker) HealthHandler ¶ added in v0.10.1
func (hc *HealthChecker) HealthHandler() http.HandlerFunc
HealthHandler returns detailed health information
func (*HealthChecker) LivenessHandler ¶ added in v0.10.1
func (hc *HealthChecker) LivenessHandler() http.HandlerFunc
LivenessHandler returns a simple liveness check
func (*HealthChecker) ReadinessHandler ¶ added in v0.10.1
func (hc *HealthChecker) ReadinessHandler() http.HandlerFunc
ReadinessHandler returns readiness status
type HealthResponse ¶ added in v0.10.1
type HealthResponse struct {
Status HealthStatus `json:"status"`
Timestamp time.Time `json:"timestamp"`
Uptime float64 `json:"uptimeSeconds"`
Version string `json:"version"`
Checks map[string]HealthCheck `json:"checks"`
System SystemInfo `json:"system"`
}
HealthResponse represents the health check response
type HealthStatus ¶ added in v0.10.1
type HealthStatus string
HealthStatus represents the overall health status
const ( HealthStatusHealthy HealthStatus = "healthy" HealthStatusDegraded HealthStatus = "degraded" HealthStatusUnhealthy HealthStatus = "unhealthy" )
type RateLimiter ¶ added in v0.10.1
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter manages login attempt rate limiting
func NewRateLimiter ¶ added in v0.10.1
func NewRateLimiter(ratePerMinute, burst int) *RateLimiter
func (*RateLimiter) Allow ¶ added in v0.10.1
func (rl *RateLimiter) Allow(key string) bool
func (*RateLimiter) CleanupOldLimiters ¶ added in v0.10.1
func (rl *RateLimiter) CleanupOldLimiters()
CleanupOldLimiters removes limiters that haven't been used recently
func (*RateLimiter) GetLimiter ¶ added in v0.10.1
func (rl *RateLimiter) GetLimiter(key string) *rate.Limiter
type SecureAuthConfig ¶ added in v0.10.1
type SecureAuthConfig struct {
Enabled bool `json:"enabled"`
Username string `json:"username"`
PasswordHash string `json:"passwordHash"` // bcrypt hash of password
SecretKey string `json:"secretKey"`
TokenExpiry int `json:"tokenExpiry"` // in hours
MaxAttempts int `json:"maxAttempts"` // max login attempts per minute
}
SecureAuthConfig holds secure authentication configuration
type SecureLoginHandler ¶ added in v0.10.1
type SecureLoginHandler struct {
// contains filtered or unexported fields
}
SecureLoginHandler handles authentication with security best practices
func NewSecureLoginHandler ¶ added in v0.10.1
func NewSecureLoginHandler(config *SecureAuthConfig, tm *SecureTokenManager, rl *RateLimiter) *SecureLoginHandler
func (*SecureLoginHandler) ServeHTTP ¶ added in v0.10.1
func (h *SecureLoginHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SecureTokenManager ¶ added in v0.10.1
type SecureTokenManager struct {
// contains filtered or unexported fields
}
SecureTokenManager handles token management with enhanced security
func NewSecureTokenManager ¶ added in v0.10.1
func NewSecureTokenManager(secretKey string, expiryHours int) (*SecureTokenManager, error)
func (*SecureTokenManager) GenerateCSRFToken ¶ added in v0.10.1
func (tm *SecureTokenManager) GenerateCSRFToken() (string, error)
GenerateCSRFToken creates a new CSRF token
func (*SecureTokenManager) GenerateToken ¶ added in v0.10.1
func (tm *SecureTokenManager) GenerateToken(username string) (string, error)
GenerateToken creates a new authentication token
func (*SecureTokenManager) RevokeToken ¶ added in v0.10.1
func (tm *SecureTokenManager) RevokeToken(token string)
RevokeToken invalidates a token
func (*SecureTokenManager) ValidateCSRFToken ¶ added in v0.10.1
func (tm *SecureTokenManager) ValidateCSRFToken(token string) bool
ValidateCSRFToken checks if a CSRF token is valid
func (*SecureTokenManager) ValidateToken ¶ added in v0.10.1
func (tm *SecureTokenManager) ValidateToken(token string) (*TokenData, bool)
ValidateToken checks if a token is valid
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServerWithAuth ¶ added in v0.17.0
func NewServerWithAuth(addr string, s *core.Scheduler, cfg interface{}, provider core.DockerProvider, authCfg *SecureAuthConfig) *Server
func (*Server) GetHTTPServer ¶ added in v0.10.1
GetHTTPServer returns the underlying http.Server for graceful shutdown support
func (*Server) HTTPServer ¶ added in v0.9.0
HTTPServer returns the underlying http.Server used by the web interface. It is exposed for tests and may change if the Server struct evolves.
func (*Server) RegisterHealthEndpoints ¶ added in v0.10.1
func (s *Server) RegisterHealthEndpoints(hc *HealthChecker)
type SystemInfo ¶ added in v0.10.1
type SystemInfo struct {
GoVersion string `json:"goVersion"`
NumGoroutine int `json:"goroutines"`
NumCPU int `json:"cpus"`
MemoryAlloc uint64 `json:"memoryAllocBytes"`
MemoryTotal uint64 `json:"memoryTotalBytes"`
GCRuns uint32 `json:"gcRuns"`
}
SystemInfo contains system-level information