Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewOtelAuditLogging ¶
func NewOtelAuditLogging(logger *slog.Logger, otelConfig *OtelConfig) func(next http.Handler) http.Handler
NewMiddleware returns a middleware function to add OTEL audit logging.
func SendOtelAuditEvent ¶
func SendOtelAuditEvent(logger *slog.Logger, otelConfig *OtelConfig, ctx context.Context, statusCode int, req *http.Request, errorMsg string)
SendOtelAuditEvent sends an OTEL audit event using the provided logger and configuration. This function replaces the method attached to loggingMiddleware.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
Middleware implements a separate OTEL audit middleware.
func (*Middleware) ServeHTTP ¶
func (m *Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP wraps the request and triggers the audit event.
type OtelConfig ¶
type OtelConfig struct {
Client *audit.Client
CustomOperationDescs map[string]string
CustomOperationCategories map[string]msgs.OperationCategory
OperationAccessLevel string
// ExcludeAuditEvents maps an HTTP method to a list of URL substrings.
// If any substring is present in the full request URL,
// the audit event for that request will be excluded.
ExcludeAuditEvents map[string][]string
}
Click to show internal directories.
Click to hide internal directories.