mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-10-06 19:49:08 +00:00
- Require API key or JWT by default for client connections - Auto-derive namespace from JWT claim or API key format `ak_<rand>:<namespace>` - Deny calls if per-call namespace override mismatches resolved namespace - Guard Storage, PubSub, Database, and NetworkInfo operations with access checks - Add context helpers for consistent namespace override handling - Update docs and add end-to-end and unit tests for authentication logic
13 lines
293 B
Go
13 lines
293 B
Go
package gateway
|
|
|
|
import "testing"
|
|
|
|
func TestNamespaceHelpers(t *testing.T) {
|
|
if p := namespacePrefix("ns"); p != "ns::ns::" {
|
|
t.Fatalf("unexpected prefix: %q", p)
|
|
}
|
|
if tpc := namespacedTopic("ns", "topic"); tpc != "ns::ns::topic" {
|
|
t.Fatalf("unexpected namespaced topic: %q", tpc)
|
|
}
|
|
}
|