feat: add customer authentication and scoped RBAC

This commit is contained in:
lingniu
2026-07-16 13:58:28 +08:00
parent 6d6c9ce534
commit a1195fb97d
28 changed files with 1738 additions and 97 deletions

View File

@@ -0,0 +1,20 @@
package app
import (
"context"
"lingniu/vehicle-data-platform/apps/api/internal/platform"
)
// IdentityAdapter is the narrow trust boundary for a future Yudao Cloud,
// RuoYi Sys or company SSO integration. Implementations must validate a signed,
// short-lived credential (or use server-side introspection) before returning a
// principal. Unsigned forwarding headers must never implement this interface.
//
// External identities should be mapped to platform_user through
// (auth_provider, external_subject); menu and vehicle grants remain platform
// authorization data so changing an upstream login system cannot bypass Scope.
type IdentityAdapter interface {
Name() string
AuthenticateBearer(context.Context, string) (platform.Principal, bool, error)
}