Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ity models Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
…ion) Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
This PR is very large. Consider breaking it into smaller PRs for easier review. |
|
@copilot 这是一段可以直接发给 AI (Copilot) 的提示词。这段提示词明确指出了模型字段与 您可以直接复制以下内容回复在 PR 的评论中,或者发给您的 AI 助手: Please update While the separation of concerns is great, our Action Items:
This ensures our Spec remains "Driver Agnostic" while providing built-in compatibility for our default driver ( |
…ort) Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
I've implemented the database field mapping configuration to handle schema differences between ObjectStack (Auth.js conventions) and better-auth. Changes made in commit
The spec is now truly driver-agnostic while providing built-in compatibility for better-auth. |
…nability Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
|
This PR is very large. Consider breaking it into smaller PRs for easier review. |
There was a problem hiding this comment.
Pull request overview
This pull request successfully refactors the authentication architecture by separating authentication configuration from identity data models, resolving architectural confusion and establishing clear boundaries.
Changes:
- Migrated enterprise authentication configurations (OIDC, SAML, LDAP) from
identity.zod.tstoauth.zod.tsunder a newenterprisefield - Redefined
identity.zod.tsas pure data models (User, Account, Session, VerificationToken) representing "who is logged in" - Created
auth-protocol.tswith wire protocol constants and interfaces (AUTH_CONSTANTS, AuthHeaders, AuthResponse, etc.) - Added database field mapping configuration to support driver compatibility (particularly better-auth)
- Comprehensive test coverage for all new schemas
- Extensive documentation updates with practical examples
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/spec/src/system/identity.zod.ts |
Complete refactoring to define User, Account, Session, and VerificationToken data models; removed authentication configuration schemas |
packages/spec/src/system/identity.test.ts |
New comprehensive test suite covering all identity data models with validation and type inference tests |
packages/spec/src/system/auth.zod.ts |
Added enterprise auth configurations (OIDC, SAML, LDAP), database field mapping schema with better-auth defaults, and integrated into AuthConfig |
packages/spec/src/system/auth.test.ts |
Added thorough tests for enterprise auth schemas and database mapping functionality |
packages/spec/src/system/auth-protocol.ts |
New file defining wire protocol constants, interfaces for headers/responses/errors, and standard error codes |
packages/spec/src/index.ts |
Updated exports with clear comments distinguishing configuration, data models, and wire protocol |
packages/spec/json-schema/*.json |
Generated/updated JSON schemas for all new and modified types; removed deprecated AuthProvider and AuthProtocol schemas |
docs/AUTHENTICATION_STANDARD.md |
Added enterprise SSO examples, database field mapping documentation, and updated architecture overview |
content/docs/references/system/*.mdx |
Updated/created MDX documentation for all new schemas with property tables |
Resolves architectural confusion between authentication providers/strategies (configuration) and user identity models (runtime data).
Changes
Migrated enterprise auth to
auth.zod.tsOIDCConfigSchema,SAMLConfigSchema,LDAPConfigSchemafrom identity.zod.tsenterprisefield toAuthConfigSchema:Redefined
identity.zod.tsas data modelsRemoved authentication configuration schemas. Replaced with runtime data models:
UserSchema: Core identity (id, email, emailVerified, name, image, timestamps) - minimal and identity-focusedAccountSchema: Links external OAuth/OIDC/SAML providers to usersSessionSchema: Session state with device fingerprintingVerificationTokenSchema: Email verification and password reset tokensCreated
auth-protocol.tsWire protocol constants and interfaces:
AUTH_CONSTANTS: Standard headers, prefixes, cookies (Authorization,Bearer,os_*)AuthHeaders,AuthResponse,AuthError,TokenPayloadinterfacesAUTH_ERROR_CODES: Standard error codesAdded database field mapping for driver compatibility
DatabaseMappingSchemato map ObjectStack standard field names (Auth.js conventions) to driver-specific field namesmappingfield toAuthConfigSchemawith pre-configured better-auth defaultsBETTER_AUTH_FIELD_MAPPINGSconstant for maintainabilitysessionToken→tokenexpires→expiresAtproviderAccountId→accountIdprovider→providerIdUpdated exports and documentation
AUTHENTICATION_STANDARD.mdArchitecture
Driver Agnostic Design
The spec now supports any authentication driver through field mapping:
BETTER_AUTH_FIELD_MAPPINGS)Breaking Changes
AuthProviderschema removed. Consumers should use:AuthConfigwith optionalenterpriseandmappingfields for configurationUser,Account,Sessionschemas for runtime dataAUTH_CONSTANTSfor protocol constantsOriginal prompt
identity.zod.ts. #48✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.