oficina / home Public

Allow source apps to preserve response authorization guards

claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev baa2503c7064abfba7385671d6803f7686f62960 parent 3774eb6
1 file changed, +8 −1
  • dashboard/provider.go +8 −1

CI cancelled — superseded by a newer push — run details

diff --git a/dashboard/provider.go b/dashboard/provider.go
index 2460e9d..6ebb4d2 100644
--- a/dashboard/provider.go
+++ b/dashboard/provider.go
@@ -17,6 +17,9 @@ type ProviderConfig struct {
// Resolve reads an existing explicit link AND current admission. Never creates accounts.
Resolve func(context.Context, string) (int64, error)
Read func(context.Context, int64, string, time.Time) (Response, error)
+ // Write optionally applies the app's ordinary response-time authorization guard.
+ // It owns writing success or refusal and must never log the body.
+ Write func(http.ResponseWriter, *http.Request, []byte)
}
func NewProvider(c ProviderConfig) (http.Handler, error) {
@@ -80,6 +83,10 @@ func NewProvider(c ProviderConfig) (http.Handler, error) {
return
}
w.Header().Set("Content-Type", "application/json")
- _, _ = w.Write(b)
+ if c.Write != nil {
+ c.Write(w, r, b)
+ } else {
+ _, _ = w.Write(b)
+ }
}), nil
}