feat(19.7-02): identity kinds, ceilings, prompts and the MCP services page
- personal tokens only behind mcp.allow_personal_tokens (401 without a lookup otherwise); an admin token yields a backend-only identity with its scope limit per dispatched method, a user token a frontend-only one - read/write ceiling and prompts proven by the tracer's subtests; the audit line asserted to carry the tool and never the arguments or token - the mounted *pier.Pier is published on the application (test seams in export_test.go) - docs/services/mcp.md with the tested acme.blog example, site.yaml note, cross-links from authentication.md, registration.md and the surf README
This commit is contained in:
25
modules/pier/export_test.go
Normal file
25
modules/pier/export_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package pier
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/bouncer"
|
||||
"git.golem15.com/golem15/summercms/modules/cabana"
|
||||
)
|
||||
|
||||
// Test seams (package pier, compiled into the test binary only).
|
||||
|
||||
// SetBackendTokens replaces the admin personal token resolver, which needs
|
||||
// a database in production (cabana.ResolveBackendToken).
|
||||
func (p *Pier) SetBackendTokens(fn func(ctx context.Context, app *backpack.App, raw string) (*bouncer.Principal, *cabana.BackendAPIToken, []string, error)) {
|
||||
p.identities.backendTokens = fn
|
||||
}
|
||||
|
||||
// Resolve resolves a bearer into an Identity as the endpoint does.
|
||||
func (p *Pier) Resolve(ctx context.Context, raw string) (Identity, error) {
|
||||
return p.identities.resolve(ctx, raw)
|
||||
}
|
||||
|
||||
// Ceiling reports whether the read/write ceiling applies to the identity.
|
||||
func (id Identity) Ceiling() bool { return id.ceiling }
|
||||
Reference in New Issue
Block a user