Files
OpenFlare/backend/openflare/plugins/server/kernel/apiutil/middleware.go
T

17 lines
646 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Copyright 2026 Arctel.net
// SPDX-License-Identifier: Apache-2.0
package apiutil
import "Wavelet/core/contracts"
// AdminMiddlewares returns Wavelet-standard middlewares for OpenFlare console routes.
// OpenFlare no longer distinguishes Admin vs Root tiers; all management endpoints share
// the same gate: RequireAuth + RequireAdmin from the platform AuthService.
//
// 返回 []any 而非 []gin.HandlerFunc:内核 RouterExtension.Use 收 ...any,
// 而 Go 不允许把 []T 直接展开成 ...any。
func AdminMiddlewares(auth contracts.AuthService) []any {
return []any{auth.RequireAuthMiddleware(), auth.RequireAdminMiddleware()}
}