- Add pact.TokenScope/HasTokenScopes and bouncer.ScopeLimit on Principal - Append backend_api_tokens migration; Allows evaluates scope before superuser - Composite guard routes Bearer g15_… to token lookup; smoke tests cover path Co-authored-by: Cursor <cursoragent@cursor.com>
28 lines
764 B
Go
28 lines
764 B
Go
package cabana
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// AdminAPIRoutes exposes the admin API route inventory (method plus
|
|
// prefix-relative path) to the external conformance test.
|
|
func AdminAPIRoutes() []string {
|
|
out := make([]string, 0, len(phase09Routes))
|
|
for _, route := range phase09Routes {
|
|
if !route.spa {
|
|
out = append(out, route.key)
|
|
}
|
|
}
|
|
return out
|
|
}
|
|
|
|
// IssueTestAPIToken mints a personal API token for ownerID with the given
|
|
// scopes and optional expiry. Used by external Postgres smoke tests before
|
|
// the HTTP create route exists.
|
|
func IssueTestAPIToken(db *gorm.DB, ownerID uint, scopes []string, expiresAt *time.Time) (plain string, err error) {
|
|
plain, _, err = issueAPIToken(db, ownerID, "test", scopes, expiresAt)
|
|
return plain, err
|
|
}
|