fix(09): WR-10 keep cabana's own backend guard when it is activated twice on one application

This commit is contained in:
Jakub Zych
2026-10-01 21:31:46 +02:00
parent 299d220b51
commit 2d96adf775
5 changed files with 40 additions and 2 deletions

View File

@@ -54,6 +54,16 @@ func (reg *Registry) Register(pluginID, name string, g any) error {
return nil
}
// Owner returns the plugin ID that registered the guard name. The second
// result is false when no guard has that name.
func (reg *Registry) Owner(name string) (string, bool) {
if reg == nil {
return "", false
}
ng, ok := reg.guards[name]
return ng.pluginID, ok
}
// Middleware derives an http middleware from a registered guard. Unknown
// names fail (fail boot, mirrors surf.RegisterMiddleware's contract).
// On Authenticate/AuthenticateCredential success: WithUser (+WithCredential