feat(mcp): add OAuth 2.1 support (#505)

* feat(mcp): add OAuth 2.1 support with dynamic client registration

* feat(api): alias bare oauth-authorization-server discovery endpoint

* fix(auth): preserve user session on OAuth sign-in redirect to consent
This commit is contained in:
Yiling-J
2026-10-29 15:39:37 +08:00
committed by GitHub
parent 96539207d0
commit baf30730af
39 changed files with 19604 additions and 44 deletions
@@ -102,7 +102,15 @@ export const ModelName = {
KanbanTaskAsset: 'KanbanTaskAsset',
KanbanTaskComment: 'KanbanTaskComment',
KanbanTaskEvent: 'KanbanTaskEvent',
RecentFileItem: 'RecentFileItem'
RecentFileItem: 'RecentFileItem',
Jwks: 'Jwks',
OauthClient: 'OauthClient',
OauthResource: 'OauthResource',
OauthClientResource: 'OauthClientResource',
OauthRefreshToken: 'OauthRefreshToken',
OauthAccessToken: 'OauthAccessToken',
OauthConsent: 'OauthConsent',
OauthClientAssertion: 'OauthClientAssertion'
} as const
export type ModelName = (typeof ModelName)[keyof typeof ModelName]
@@ -877,6 +885,161 @@ export const RecentFileItemScalarFieldEnum = {
export type RecentFileItemScalarFieldEnum = (typeof RecentFileItemScalarFieldEnum)[keyof typeof RecentFileItemScalarFieldEnum]
export const JwksScalarFieldEnum = {
id: 'id',
publicKey: 'publicKey',
privateKey: 'privateKey',
createdAt: 'createdAt',
expiresAt: 'expiresAt',
alg: 'alg',
crv: 'crv'
} as const
export type JwksScalarFieldEnum = (typeof JwksScalarFieldEnum)[keyof typeof JwksScalarFieldEnum]
export const OauthClientScalarFieldEnum = {
id: 'id',
clientId: 'clientId',
clientSecret: 'clientSecret',
clientDiscoveryId: 'clientDiscoveryId',
disabled: 'disabled',
skipConsent: 'skipConsent',
enableEndSession: 'enableEndSession',
subjectType: 'subjectType',
scopes: 'scopes',
clientCredentialsScopes: 'clientCredentialsScopes',
userId: 'userId',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
name: 'name',
uri: 'uri',
icon: 'icon',
contacts: 'contacts',
tos: 'tos',
policy: 'policy',
softwareId: 'softwareId',
softwareVersion: 'softwareVersion',
softwareStatement: 'softwareStatement',
redirectUris: 'redirectUris',
postLogoutRedirectUris: 'postLogoutRedirectUris',
backchannelLogoutUri: 'backchannelLogoutUri',
backchannelLogoutSessionRequired: 'backchannelLogoutSessionRequired',
tokenEndpointAuthMethod: 'tokenEndpointAuthMethod',
applicationType: 'applicationType',
jwks: 'jwks',
jwksUri: 'jwksUri',
grantTypes: 'grantTypes',
responseTypes: 'responseTypes',
requirePKCE: 'requirePKCE',
dpopBoundAccessTokens: 'dpopBoundAccessTokens',
referenceId: 'referenceId',
metadata: 'metadata'
} as const
export type OauthClientScalarFieldEnum = (typeof OauthClientScalarFieldEnum)[keyof typeof OauthClientScalarFieldEnum]
export const OauthResourceScalarFieldEnum = {
id: 'id',
identifier: 'identifier',
name: 'name',
accessTokenTtl: 'accessTokenTtl',
refreshTokenTtl: 'refreshTokenTtl',
signingAlgorithm: 'signingAlgorithm',
signingKeyId: 'signingKeyId',
allowedScopes: 'allowedScopes',
customClaims: 'customClaims',
dpopBoundAccessTokensRequired: 'dpopBoundAccessTokensRequired',
disabled: 'disabled',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
policyVersion: 'policyVersion',
metadata: 'metadata'
} as const
export type OauthResourceScalarFieldEnum = (typeof OauthResourceScalarFieldEnum)[keyof typeof OauthResourceScalarFieldEnum]
export const OauthClientResourceScalarFieldEnum = {
id: 'id',
clientId: 'clientId',
resourceId: 'resourceId',
metadata: 'metadata',
createdAt: 'createdAt'
} as const
export type OauthClientResourceScalarFieldEnum = (typeof OauthClientResourceScalarFieldEnum)[keyof typeof OauthClientResourceScalarFieldEnum]
export const OauthRefreshTokenScalarFieldEnum = {
id: 'id',
token: 'token',
clientId: 'clientId',
sessionId: 'sessionId',
userId: 'userId',
referenceId: 'referenceId',
authorizationCodeId: 'authorizationCodeId',
resources: 'resources',
requestedUserInfoClaims: 'requestedUserInfoClaims',
expiresAt: 'expiresAt',
createdAt: 'createdAt',
revoked: 'revoked',
rotatedAt: 'rotatedAt',
rotationReplayResponse: 'rotationReplayResponse',
rotationReplayExpiresAt: 'rotationReplayExpiresAt',
authTime: 'authTime',
confirmation: 'confirmation',
scopes: 'scopes'
} as const
export type OauthRefreshTokenScalarFieldEnum = (typeof OauthRefreshTokenScalarFieldEnum)[keyof typeof OauthRefreshTokenScalarFieldEnum]
export const OauthAccessTokenScalarFieldEnum = {
id: 'id',
token: 'token',
clientId: 'clientId',
sessionId: 'sessionId',
userId: 'userId',
referenceId: 'referenceId',
authorizationCodeId: 'authorizationCodeId',
resources: 'resources',
requestedUserInfoClaims: 'requestedUserInfoClaims',
refreshId: 'refreshId',
expiresAt: 'expiresAt',
createdAt: 'createdAt',
revoked: 'revoked',
confirmation: 'confirmation',
scopes: 'scopes'
} as const
export type OauthAccessTokenScalarFieldEnum = (typeof OauthAccessTokenScalarFieldEnum)[keyof typeof OauthAccessTokenScalarFieldEnum]
export const OauthConsentScalarFieldEnum = {
id: 'id',
clientId: 'clientId',
userId: 'userId',
referenceId: 'referenceId',
resources: 'resources',
requestedUserInfoClaims: 'requestedUserInfoClaims',
scopes: 'scopes',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
export type OauthConsentScalarFieldEnum = (typeof OauthConsentScalarFieldEnum)[keyof typeof OauthConsentScalarFieldEnum]
export const OauthClientAssertionScalarFieldEnum = {
id: 'id',
expiresAt: 'expiresAt'
} as const
export type OauthClientAssertionScalarFieldEnum = (typeof OauthClientAssertionScalarFieldEnum)[keyof typeof OauthClientAssertionScalarFieldEnum]
export const SortOrder = {
asc: 'asc',
desc: 'desc'