feat: verified frontend account link for administrators
- golem15_user_backend_links (1:1, both sides unique) and one-shot hashed
golem15_user_backend_link_requests (golem15.user.backend_links.request_ttl, 10m)
- classes.BackendLinks: CreateLinkRequest, ConfirmLinkRequest (row lock,
JWT iat not before the request), SetLink, RemoveLink, LinkedBackendUser;
published as *classes.BackendLinks and pact.MCPLinkedBackendResolver
- GET /_user/api/v1/backend-link/{code} and POST /backend-link/confirm (jwt.auth)
- My account section frontend_account with link and unlink
- BackendLinkedEvent, BackendUnlinkedEvent and pact.MCPSubjectChanged after commit;
deleting or deactivating a frontend user removes its link
- golem15.user.frontend_url (falls back to app.url)
This commit is contained in:
22
plugin.go
22
plugin.go
@@ -107,9 +107,31 @@ func (p *Plugin) Boot(app *backpack.App) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := p.bootBackendLinks(app); err != nil {
|
||||
return err
|
||||
}
|
||||
return classes.RegisterUserAuthorizer(app)
|
||||
}
|
||||
|
||||
// bootBackendLinks publishes the account link service as *classes.BackendLinks
|
||||
// and as the MCP linked-backend resolver, and removes a frontend user's link
|
||||
// when the user is deleted or deactivated. The request lifetime is checked
|
||||
// here so a bad golem15.user.backend_links.request_ttl fails the boot.
|
||||
func (p *Plugin) bootBackendLinks(app *backpack.App) error {
|
||||
if _, err := classes.BackendLinkRequestTTL(app); err != nil {
|
||||
return err
|
||||
}
|
||||
links := &classes.BackendLinks{App: app}
|
||||
if err := app.Publish(links); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := app.Publish[pact.MCPLinkedBackendResolver](links); err != nil {
|
||||
return err
|
||||
}
|
||||
links.RegisterBackendLinkListeners(app)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Plugin) startBlacklistSweep(bl bouncer.BlacklistStore) {
|
||||
interval := 10 * time.Minute
|
||||
if p.app != nil && p.app.Config != nil {
|
||||
|
||||
Reference in New Issue
Block a user