@authup/server-core 1.0.0-beta.38 → 1.0.0-beta.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/adapters/http/adapters/index.mjs +2 -1
  2. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts +2 -1
  3. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.d.ts.map +1 -1
  4. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs +10 -1
  5. package/dist/adapters/http/adapters/oauth2/grant-types/authorize.mjs.map +1 -1
  6. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.d.ts.map +1 -1
  7. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs +5 -13
  8. package/dist/adapters/http/adapters/oauth2/grant-types/client-credentials.mjs.map +1 -1
  9. package/dist/adapters/http/adapters/oauth2/grant-types/index.mjs +2 -1
  10. package/dist/adapters/http/adapters/oauth2/grant-types/password.d.ts +2 -1
  11. package/dist/adapters/http/adapters/oauth2/grant-types/password.d.ts.map +1 -1
  12. package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs +11 -2
  13. package/dist/adapters/http/adapters/oauth2/grant-types/password.mjs.map +1 -1
  14. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts +5 -1
  15. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.d.ts.map +1 -1
  16. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs +19 -1
  17. package/dist/adapters/http/adapters/oauth2/grant-types/refresh_token.mjs.map +1 -1
  18. package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts +6 -1
  19. package/dist/adapters/http/adapters/oauth2/grant-types/types.d.ts.map +1 -1
  20. package/dist/adapters/http/adapters/oauth2/grant-types/utils/credentials.d.ts +15 -0
  21. package/dist/adapters/http/adapters/oauth2/grant-types/utils/credentials.d.ts.map +1 -0
  22. package/dist/adapters/http/adapters/oauth2/grant-types/utils/credentials.mjs +57 -0
  23. package/dist/adapters/http/adapters/oauth2/grant-types/utils/credentials.mjs.map +1 -0
  24. package/dist/adapters/http/adapters/oauth2/grant-types/utils/guess.mjs +1 -1
  25. package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.d.ts +1 -0
  26. package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.d.ts.map +1 -1
  27. package/dist/adapters/http/adapters/oauth2/grant-types/utils/index.mjs +2 -1
  28. package/dist/adapters/http/adapters/oauth2/index.mjs +2 -1
  29. package/dist/adapters/http/controllers/entities/client/module.d.ts.map +1 -1
  30. package/dist/adapters/http/controllers/entities/client/module.mjs +1 -1
  31. package/dist/adapters/http/controllers/entities/client/module.mjs.map +1 -1
  32. package/dist/adapters/http/controllers/entities/policy/utils/validation.d.ts.map +1 -1
  33. package/dist/adapters/http/controllers/entities/policy/utils/validation.mjs +1 -1
  34. package/dist/adapters/http/controllers/entities/policy/utils/validation.mjs.map +1 -1
  35. package/dist/adapters/http/controllers/entities/robot/module.d.ts.map +1 -1
  36. package/dist/adapters/http/controllers/entities/robot/module.mjs +1 -1
  37. package/dist/adapters/http/controllers/entities/robot/module.mjs.map +1 -1
  38. package/dist/adapters/http/controllers/workflows/token/module.d.ts.map +1 -1
  39. package/dist/adapters/http/controllers/workflows/token/module.mjs +4 -1
  40. package/dist/adapters/http/controllers/workflows/token/module.mjs.map +1 -1
  41. package/dist/adapters/http/controllers/workflows/token/types.d.ts +2 -1
  42. package/dist/adapters/http/controllers/workflows/token/types.d.ts.map +1 -1
  43. package/dist/adapters/http/index.mjs +2 -1
  44. package/dist/app/modules/database/repositories/client/repository.d.ts +1 -0
  45. package/dist/app/modules/database/repositories/client/repository.d.ts.map +1 -1
  46. package/dist/app/modules/database/repositories/client/repository.mjs +40 -1
  47. package/dist/app/modules/database/repositories/client/repository.mjs.map +1 -1
  48. package/dist/app/modules/database/repositories/permission/repository.mjs +1 -1
  49. package/dist/app/modules/database/repositories/permission/repository.mjs.map +1 -1
  50. package/dist/app/modules/database/repositories/policy/repository.mjs +1 -1
  51. package/dist/app/modules/database/repositories/policy/repository.mjs.map +1 -1
  52. package/dist/app/modules/database/repositories/realm/repository.mjs +1 -1
  53. package/dist/app/modules/database/repositories/realm/repository.mjs.map +1 -1
  54. package/dist/app/modules/database/repositories/robot/repository.d.ts +1 -0
  55. package/dist/app/modules/database/repositories/robot/repository.d.ts.map +1 -1
  56. package/dist/app/modules/database/repositories/robot/repository.mjs +32 -1
  57. package/dist/app/modules/database/repositories/robot/repository.mjs.map +1 -1
  58. package/dist/app/modules/database/repositories/role/repository.mjs +1 -1
  59. package/dist/app/modules/database/repositories/role/repository.mjs.map +1 -1
  60. package/dist/app/modules/database/repositories/scope/repository.mjs +1 -1
  61. package/dist/app/modules/database/repositories/scope/repository.mjs.map +1 -1
  62. package/dist/app/modules/database/repositories/user/repository.mjs +2 -2
  63. package/dist/app/modules/database/repositories/user/repository.mjs.map +1 -1
  64. package/dist/app/modules/http/modules/controller.d.ts.map +1 -1
  65. package/dist/app/modules/http/modules/controller.mjs +2 -0
  66. package/dist/app/modules/http/modules/controller.mjs.map +1 -1
  67. package/dist/core/entities/client/service.d.ts +1 -1
  68. package/dist/core/entities/client/service.d.ts.map +1 -1
  69. package/dist/core/entities/client/service.mjs +12 -19
  70. package/dist/core/entities/client/service.mjs.map +1 -1
  71. package/dist/core/entities/client/types.d.ts +2 -1
  72. package/dist/core/entities/client/types.d.ts.map +1 -1
  73. package/dist/core/entities/robot/service.d.ts +1 -1
  74. package/dist/core/entities/robot/service.d.ts.map +1 -1
  75. package/dist/core/entities/robot/service.mjs +12 -18
  76. package/dist/core/entities/robot/service.mjs.map +1 -1
  77. package/dist/core/entities/robot/types.d.ts +2 -1
  78. package/dist/core/entities/robot/types.d.ts.map +1 -1
  79. package/dist/core/entities/user/service.d.ts.map +1 -1
  80. package/dist/core/entities/user/service.mjs +10 -13
  81. package/dist/core/entities/user/service.mjs.map +1 -1
  82. package/dist/core/identity/password-recovery/service.d.ts.map +1 -1
  83. package/dist/core/identity/password-recovery/service.mjs +4 -4
  84. package/dist/core/identity/password-recovery/service.mjs.map +1 -1
  85. package/dist/core/identity/provider/account/module.d.ts.map +1 -1
  86. package/dist/core/identity/provider/account/module.mjs +3 -2
  87. package/dist/core/identity/provider/account/module.mjs.map +1 -1
  88. package/dist/core/index.mjs +2 -1
  89. package/dist/core/oauth2/authorization/code/verifier/module.d.ts.map +1 -1
  90. package/dist/core/oauth2/authorization/code/verifier/module.mjs +8 -4
  91. package/dist/core/oauth2/authorization/code/verifier/module.mjs.map +1 -1
  92. package/dist/core/oauth2/authorization/code/verifier/types.d.ts +2 -0
  93. package/dist/core/oauth2/authorization/code/verifier/types.d.ts.map +1 -1
  94. package/dist/core/oauth2/authorization/code-request/verifier/module.d.ts.map +1 -1
  95. package/dist/core/oauth2/authorization/code-request/verifier/module.mjs +7 -1
  96. package/dist/core/oauth2/authorization/code-request/verifier/module.mjs.map +1 -1
  97. package/dist/core/oauth2/client/authenticator.d.ts +17 -0
  98. package/dist/core/oauth2/client/authenticator.d.ts.map +1 -0
  99. package/dist/core/oauth2/client/authenticator.mjs +34 -0
  100. package/dist/core/oauth2/client/authenticator.mjs.map +1 -0
  101. package/dist/core/oauth2/client/index.d.ts +1 -0
  102. package/dist/core/oauth2/client/index.d.ts.map +1 -1
  103. package/dist/core/oauth2/client/index.mjs +2 -1
  104. package/dist/core/oauth2/grant-types/password.d.ts +7 -3
  105. package/dist/core/oauth2/grant-types/password.d.ts.map +1 -1
  106. package/dist/core/oauth2/grant-types/password.mjs +9 -7
  107. package/dist/core/oauth2/grant-types/password.mjs.map +1 -1
  108. package/dist/core/oauth2/index.mjs +3 -1
  109. package/dist/core/oauth2/token/issuer/base.d.ts.map +1 -1
  110. package/dist/core/oauth2/token/issuer/base.mjs +3 -2
  111. package/dist/core/oauth2/token/issuer/base.mjs.map +1 -1
  112. package/dist/index.mjs +2 -1
  113. package/dist/ui/client/assets/index-Noe7uiOY.js +41 -0
  114. package/dist/ui/client/index.html +1 -1
  115. package/dist/ui/server/server.js +21 -7
  116. package/package.json +9 -9
  117. package/dist/ui/client/assets/index-AHa03lX_.js +0 -41
@@ -1 +1 @@
1
- {"version":3,"file":"module.mjs","names":["UserValidator","ValidatorGroup","buildUserFakeEmail","isUserFakeEmail","createNanoID","extendObject","isValidupError","stringifyPath","IdentityProviderIdentityOperation","IdentityProviderMapperOperation","IdentityProviderAccountManager","attributesMapper","permissionMapper","roleMapper","repository","userRepository","userValidator","ctx","attributeMapper","save","identity","account","findOneByProviderIdentity","operation","UPDATE","user","saveUser","saveRoles","savePermissions","CREATE","provider_id","provider","id","provider_user_id","provider_user_name","name","provider_realm_id","realm_id","user_id","user_realm_id","attributes","execute","entity","attribute","key","value","active","name_locked","client_id","clientId","attributesSelf","validateAttributes","Error","attributesSelfKeys","Object","keys","attributesExtra","entityKeys","entityKey","index","indexOf","output","attempts","Math","max","attributeCandidates","length","saveOneWithEA","names","shift","run","group","email","e","retry","i","issues","child","pathNormalized","path","Array","isArray","first","rest","push","entities"],"sources":["../../../../../src/core/identity/provider/account/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { IdentityProviderAccount, User } from '@authup/core-kit';\nimport {\n UserValidator, \n ValidatorGroup,\n buildUserFakeEmail, \n isUserFakeEmail,\n} from '@authup/core-kit';\nimport { createNanoID, extendObject } from '@authup/kit';\nimport { isValidupError, stringifyPath } from 'validup';\nimport type { IUserIdentityRepository } from '../../entities/index.ts';\nimport { IdentityProviderIdentityOperation } from '../constants.ts';\nimport type { IIdentityProviderMapper } from '../mapper/index.ts';\nimport { IdentityProviderMapperOperation } from '../mapper/index.ts';\nimport type { IdentityProviderIdentity } from '../types.ts';\nimport type { IIdentityProviderAccountManager, IIdentityProviderAccountRepository, IdentityProviderAccountManagerContext } from './types.ts';\n\nexport class IdentityProviderAccountManager implements IIdentityProviderAccountManager {\n protected attributesMapper : IIdentityProviderMapper;\n\n protected permissionMapper : IIdentityProviderMapper;\n\n protected roleMapper : IIdentityProviderMapper;\n\n protected repository : IIdentityProviderAccountRepository;\n\n protected userRepository: IUserIdentityRepository;\n\n protected userValidator : UserValidator;\n\n constructor(ctx: IdentityProviderAccountManagerContext) {\n this.attributesMapper = ctx.attributeMapper;\n this.permissionMapper = ctx.permissionMapper;\n this.roleMapper = ctx.roleMapper;\n this.repository = ctx.repository;\n this.userRepository = ctx.userRepository;\n\n this.userValidator = new UserValidator();\n }\n\n async save(identity: IdentityProviderIdentity): Promise<IdentityProviderAccount> {\n let account = await this.repository.findOneByProviderIdentity(identity);\n if (account) {\n identity.operation = IdentityProviderIdentityOperation.UPDATE;\n\n account.user = await this.saveUser(identity, account.user);\n\n await this.repository.save(account);\n\n await this.saveRoles(identity, account.user);\n await this.savePermissions(identity, account.user);\n\n return account;\n }\n\n identity.operation = IdentityProviderIdentityOperation.CREATE;\n\n const user = await this.saveUser(identity);\n\n account = await this.repository.save({\n provider_id: identity.provider.id,\n provider_user_id: identity.id,\n provider_user_name: user.name, // todo: parse identity.name\n provider_realm_id: identity.provider.realm_id,\n user,\n user_id: user.id,\n user_realm_id: user.realm_id,\n });\n\n await this.saveRoles(identity, account.user);\n await this.savePermissions(identity, account.user);\n\n return account;\n }\n\n async saveUser(\n identity: IdentityProviderIdentity,\n user?: User,\n ): Promise<User> {\n const attributes = await this.attributesMapper.execute(\n identity,\n );\n\n const entity : Record<string, any> = {};\n for (const attribute of attributes) {\n if (\n attribute.key &&\n attribute.operation === IdentityProviderMapperOperation.CREATE\n ) {\n // attribute value might be object, array, ...\n entity[attribute.key] = attribute.value;\n }\n }\n\n if (!user) {\n entity.realm_id = identity.provider.realm_id;\n entity.active = true;\n entity.name_locked = true;\n entity.client_id = identity.clientId || null;\n }\n\n const attributesSelf = await this.validateAttributes(entity, identity, 10);\n if (!attributesSelf) {\n // todo: better error name\n throw new Error('Identity provider attributes could not be validated.');\n }\n const attributesSelfKeys = Object.keys(attributesSelf);\n\n const attributesExtra : Record<string, any> = {};\n\n const entityKeys = Object.keys(entity);\n for (const entityKey of entityKeys) {\n const index = attributesSelfKeys.indexOf(entityKey);\n if (index !== -1) {\n continue;\n }\n\n attributesExtra[entityKey] = entity[entityKey];\n }\n\n let output : User;\n if (user) {\n output = extendObject(user, attributesSelf);\n } else {\n output = attributesSelf;\n }\n\n let attempts = Math.max((identity.attributeCandidates?.name?.length || 0) + 1, 10);\n while (attempts > 0) {\n try {\n // todo: we also need to remove existing ones via idp login flow ( but not other attributes!)\n return await this.userRepository.saveOneWithEA(output, attributesExtra);\n } catch {\n const names = identity.attributeCandidates?.name || [];\n if (names.length > 0) {\n while (names.length > 0) {\n output.name = `${names.shift()}`;\n\n try {\n await this.userValidator.run(output, {\n group: identity.operation === IdentityProviderIdentityOperation.CREATE ?\n ValidatorGroup.CREATE :\n ValidatorGroup.UPDATE,\n });\n break;\n } catch {\n // todo: do nothing.\n }\n }\n } else {\n output.name = createNanoID('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_', 10);\n }\n\n if (isUserFakeEmail(output.email)) {\n output.email = buildUserFakeEmail(output.name);\n }\n\n attempts -= 1;\n }\n }\n\n throw new Error('The user account could not be created due a conflict error.');\n }\n\n async validateAttributes(\n entity: Record<string, any>,\n identity: IdentityProviderIdentity,\n attempts: number,\n ) : Promise<User | null> {\n attempts--;\n if (attempts <= 0) {\n return null;\n }\n\n try {\n return await this.userValidator.run(entity, {\n group: identity.operation === IdentityProviderIdentityOperation.CREATE ?\n ValidatorGroup.CREATE :\n ValidatorGroup.UPDATE,\n });\n } catch (e: any) {\n if (!isValidupError(e)) {\n return null;\n }\n\n let retry = false;\n for (let i = 0; i < e.issues.length; i++) {\n const child = e.issues[i];\n\n const pathNormalized = stringifyPath(child.path);\n\n if (\n Array.isArray(entity[pathNormalized]) &&\n entity[pathNormalized].length > 0\n ) {\n const [first, ...rest] = entity[pathNormalized];\n entity[pathNormalized] = first;\n\n if (rest.length > 0) {\n if (!identity.attributeCandidates) {\n identity.attributeCandidates = {};\n }\n\n if (!identity.attributeCandidates[pathNormalized]) {\n identity.attributeCandidates[pathNormalized] = [];\n }\n\n identity.attributeCandidates[pathNormalized]!.push(...rest);\n }\n\n retry = true;\n break;\n }\n\n if (\n identity.attributeCandidates &&\n identity.attributeCandidates[pathNormalized] &&\n identity.attributeCandidates[pathNormalized]!.length > 0\n ) {\n entity[pathNormalized] = identity.attributeCandidates[pathNormalized]!.shift();\n retry = true;\n break;\n }\n\n if (\n entity.name &&\n pathNormalized === 'email'\n ) {\n entity[pathNormalized] = buildUserFakeEmail(entity.name);\n retry = true;\n break;\n }\n\n if (entity[pathNormalized]) {\n entity[pathNormalized] = null;\n break;\n }\n }\n\n if (retry) {\n return this.validateAttributes(entity, identity, attempts);\n }\n\n return null;\n }\n }\n\n async savePermissions(\n identity: IdentityProviderIdentity,\n user: User,\n ) {\n const entities = await this.permissionMapper.execute(identity);\n\n await this.userRepository.savePermissions(user, entities);\n }\n\n async saveRoles(\n identity: IdentityProviderIdentity,\n user: User,\n ) {\n const entities = await this.roleMapper.execute(identity);\n\n await this.userRepository.saveRoles(user, entities);\n }\n}\n"],"mappings":";;;;;;;AAuBA,IAAaU,iCAAb,MAAaA;CACCC;CAEAC;CAEAC;CAEAC;CAEAC;CAEAC;CAEV,YAAYC,KAA4C;AACpD,OAAKN,mBAAmBM,IAAIC;AAC5B,OAAKN,mBAAmBK,IAAIL;AAC5B,OAAKC,aAAaI,IAAIJ;AACtB,OAAKC,aAAaG,IAAIH;AACtB,OAAKC,iBAAiBE,IAAIF;AAE1B,OAAKC,gBAAgB,IAAIhB,eAAAA;;CAG7B,MAAMmB,KAAKC,UAAsE;EAC7E,IAAIC,UAAU,MAAM,KAAKP,WAAWQ,0BAA0BF,SAAAA;AAC9D,MAAIC,SAAS;AACTD,YAASG,YAAYf,kCAAkCgB;AAEvDH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AAA"}
1
+ {"version":3,"file":"module.mjs","names":["UserValidator","ValidatorGroup","buildUserFakeEmail","isUserFakeEmail","createNanoID","extendObject","isValidupError","stringifyPath","IdentityProviderIdentityOperation","IdentityProviderMapperOperation","IdentityProviderAccountManager","attributesMapper","permissionMapper","roleMapper","repository","userRepository","userValidator","ctx","attributeMapper","save","identity","account","findOneByProviderIdentity","operation","UPDATE","user","saveUser","saveRoles","savePermissions","CREATE","provider_id","provider","id","provider_user_id","provider_user_name","name","provider_realm_id","realm_id","user_id","user_realm_id","attributes","execute","entity","attribute","key","value","active","name_locked","client_id","clientId","attributesSelf","validateAttributes","Error","attributesSelfKeys","Object","keys","attributesExtra","entityKeys","entityKey","index","indexOf","output","trim","toLowerCase","attempts","Math","max","attributeCandidates","length","saveOneWithEA","names","shift","run","group","email","e","retry","i","issues","child","pathNormalized","path","Array","isArray","first","rest","push","entities"],"sources":["../../../../../src/core/identity/provider/account/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { IdentityProviderAccount, User } from '@authup/core-kit';\nimport {\n UserValidator, \n ValidatorGroup,\n buildUserFakeEmail, \n isUserFakeEmail,\n} from '@authup/core-kit';\nimport { createNanoID, extendObject } from '@authup/kit';\nimport { isValidupError, stringifyPath } from 'validup';\nimport type { IUserIdentityRepository } from '../../entities/index.ts';\nimport { IdentityProviderIdentityOperation } from '../constants.ts';\nimport type { IIdentityProviderMapper } from '../mapper/index.ts';\nimport { IdentityProviderMapperOperation } from '../mapper/index.ts';\nimport type { IdentityProviderIdentity } from '../types.ts';\nimport type { IIdentityProviderAccountManager, IIdentityProviderAccountRepository, IdentityProviderAccountManagerContext } from './types.ts';\n\nexport class IdentityProviderAccountManager implements IIdentityProviderAccountManager {\n protected attributesMapper : IIdentityProviderMapper;\n\n protected permissionMapper : IIdentityProviderMapper;\n\n protected roleMapper : IIdentityProviderMapper;\n\n protected repository : IIdentityProviderAccountRepository;\n\n protected userRepository: IUserIdentityRepository;\n\n protected userValidator : UserValidator;\n\n constructor(ctx: IdentityProviderAccountManagerContext) {\n this.attributesMapper = ctx.attributeMapper;\n this.permissionMapper = ctx.permissionMapper;\n this.roleMapper = ctx.roleMapper;\n this.repository = ctx.repository;\n this.userRepository = ctx.userRepository;\n\n this.userValidator = new UserValidator();\n }\n\n async save(identity: IdentityProviderIdentity): Promise<IdentityProviderAccount> {\n let account = await this.repository.findOneByProviderIdentity(identity);\n if (account) {\n identity.operation = IdentityProviderIdentityOperation.UPDATE;\n\n account.user = await this.saveUser(identity, account.user);\n\n await this.repository.save(account);\n\n await this.saveRoles(identity, account.user);\n await this.savePermissions(identity, account.user);\n\n return account;\n }\n\n identity.operation = IdentityProviderIdentityOperation.CREATE;\n\n const user = await this.saveUser(identity);\n\n account = await this.repository.save({\n provider_id: identity.provider.id,\n provider_user_id: identity.id,\n provider_user_name: user.name, // todo: parse identity.name\n provider_realm_id: identity.provider.realm_id,\n user,\n user_id: user.id,\n user_realm_id: user.realm_id,\n });\n\n await this.saveRoles(identity, account.user);\n await this.savePermissions(identity, account.user);\n\n return account;\n }\n\n async saveUser(\n identity: IdentityProviderIdentity,\n user?: User,\n ): Promise<User> {\n const attributes = await this.attributesMapper.execute(\n identity,\n );\n\n const entity : Record<string, any> = {};\n for (const attribute of attributes) {\n if (\n attribute.key &&\n attribute.operation === IdentityProviderMapperOperation.CREATE\n ) {\n // attribute value might be object, array, ...\n entity[attribute.key] = attribute.value;\n }\n }\n\n if (!user) {\n entity.realm_id = identity.provider.realm_id;\n entity.active = true;\n entity.name_locked = true;\n entity.client_id = identity.clientId || null;\n }\n\n const attributesSelf = await this.validateAttributes(entity, identity, 10);\n if (!attributesSelf) {\n // todo: better error name\n throw new Error('Identity provider attributes could not be validated.');\n }\n const attributesSelfKeys = Object.keys(attributesSelf);\n\n const attributesExtra : Record<string, any> = {};\n\n const entityKeys = Object.keys(entity);\n for (const entityKey of entityKeys) {\n const index = attributesSelfKeys.indexOf(entityKey);\n if (index !== -1) {\n continue;\n }\n\n attributesExtra[entityKey] = entity[entityKey];\n }\n\n let output : User;\n if (user) {\n output = extendObject(user, attributesSelf);\n } else {\n output = attributesSelf;\n }\n\n if (typeof output.name === 'string') {\n output.name = output.name.trim().toLowerCase();\n }\n\n let attempts = Math.max((identity.attributeCandidates?.name?.length || 0) + 1, 10);\n while (attempts > 0) {\n try {\n // todo: we also need to remove existing ones via idp login flow ( but not other attributes!)\n return await this.userRepository.saveOneWithEA(output, attributesExtra);\n } catch {\n const names = identity.attributeCandidates?.name || [];\n if (names.length > 0) {\n while (names.length > 0) {\n output.name = `${names.shift()}`.trim().toLowerCase();\n\n try {\n await this.userValidator.run(output, {\n group: identity.operation === IdentityProviderIdentityOperation.CREATE ?\n ValidatorGroup.CREATE :\n ValidatorGroup.UPDATE,\n });\n break;\n } catch {\n // todo: do nothing.\n }\n }\n } else {\n output.name = createNanoID('0123456789abcdefghijklmnopqrstuvwxyz-_', 10);\n }\n\n if (isUserFakeEmail(output.email)) {\n output.email = buildUserFakeEmail(output.name);\n }\n\n attempts -= 1;\n }\n }\n\n throw new Error('The user account could not be created due a conflict error.');\n }\n\n async validateAttributes(\n entity: Record<string, any>,\n identity: IdentityProviderIdentity,\n attempts: number,\n ) : Promise<User | null> {\n attempts--;\n if (attempts <= 0) {\n return null;\n }\n\n try {\n return await this.userValidator.run(entity, {\n group: identity.operation === IdentityProviderIdentityOperation.CREATE ?\n ValidatorGroup.CREATE :\n ValidatorGroup.UPDATE,\n });\n } catch (e: any) {\n if (!isValidupError(e)) {\n return null;\n }\n\n let retry = false;\n for (let i = 0; i < e.issues.length; i++) {\n const child = e.issues[i];\n\n const pathNormalized = stringifyPath(child.path);\n\n if (\n Array.isArray(entity[pathNormalized]) &&\n entity[pathNormalized].length > 0\n ) {\n const [first, ...rest] = entity[pathNormalized];\n entity[pathNormalized] = first;\n\n if (rest.length > 0) {\n if (!identity.attributeCandidates) {\n identity.attributeCandidates = {};\n }\n\n if (!identity.attributeCandidates[pathNormalized]) {\n identity.attributeCandidates[pathNormalized] = [];\n }\n\n identity.attributeCandidates[pathNormalized]!.push(...rest);\n }\n\n retry = true;\n break;\n }\n\n if (\n identity.attributeCandidates &&\n identity.attributeCandidates[pathNormalized] &&\n identity.attributeCandidates[pathNormalized]!.length > 0\n ) {\n entity[pathNormalized] = identity.attributeCandidates[pathNormalized]!.shift();\n retry = true;\n break;\n }\n\n if (\n entity.name &&\n pathNormalized === 'email'\n ) {\n entity[pathNormalized] = buildUserFakeEmail(entity.name);\n retry = true;\n break;\n }\n\n if (entity[pathNormalized]) {\n entity[pathNormalized] = null;\n break;\n }\n }\n\n if (retry) {\n return this.validateAttributes(entity, identity, attempts);\n }\n\n return null;\n }\n }\n\n async savePermissions(\n identity: IdentityProviderIdentity,\n user: User,\n ) {\n const entities = await this.permissionMapper.execute(identity);\n\n await this.userRepository.savePermissions(user, entities);\n }\n\n async saveRoles(\n identity: IdentityProviderIdentity,\n user: User,\n ) {\n const entities = await this.roleMapper.execute(identity);\n\n await this.userRepository.saveRoles(user, entities);\n }\n}\n"],"mappings":";;;;;;;AAuBA,IAAaU,iCAAb,MAAaA;CACCC;CAEAC;CAEAC;CAEAC;CAEAC;CAEAC;CAEV,YAAYC,KAA4C;AACpD,OAAKN,mBAAmBM,IAAIC;AAC5B,OAAKN,mBAAmBK,IAAIL;AAC5B,OAAKC,aAAaI,IAAIJ;AACtB,OAAKC,aAAaG,IAAIH;AACtB,OAAKC,iBAAiBE,IAAIF;AAE1B,OAAKC,gBAAgB,IAAIhB,eAAAA;;CAG7B,MAAMmB,KAAKC,UAAsE;EAC7E,IAAIC,UAAU,MAAM,KAAKP,WAAWQ,0BAA0BF,SAAAA;AAC9D,MAAIC,SAAS;AACTD,YAASG,YAAYf,kCAAkCgB;AAEvDH,WAAQI,OAAO,MAAM,KAAKC,SAASN,UAAUC,QAAQI,KAAI;AAEzD,SAAM,KAAKX,WA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AA;AAE/C,QAAM,KAAKL,eAAeY,UAAUF,MAAM8D,SAAAA"}
@@ -37,6 +37,7 @@ import { OAuth2AuthorizationCodeRequestVerifier } from "./oauth2/authorization/c
37
37
  import { OAuth2AuthorizationCodeRequestValidator } from "./oauth2/authorization/code-request/validator.mjs";
38
38
  import { OAuth2AuthorizationStateManager } from "./oauth2/authorization/state/module.mjs";
39
39
  import { OAuth2Authorization } from "./oauth2/authorization/module.mjs";
40
+ import { OAuth2ClientAuthenticator } from "./oauth2/client/authenticator.mjs";
40
41
  import { buildOAuth2BearerTokenResponse } from "./oauth2/response/bearer.mjs";
41
42
  import { OAuth2AuthorizeGrant } from "./oauth2/grant-types/authorize.mjs";
42
43
  import { ClientCredentialsGrant } from "./oauth2/grant-types/client-credentials.mjs";
@@ -102,4 +103,4 @@ import "./provisioning/index.mjs";
102
103
  import { PermissionBindingPolicyEvaluator } from "./security/policy/evaluator.mjs";
103
104
  import { PolicyEngine } from "./security/policy/engine.mjs";
104
105
  import "./security/index.mjs";
105
- export { AbstractEntityService, BaseCredentialsAuthenticator, ClientAuthenticator, ClientCredentialsGrant, ClientCredentialsService, ClientPermissionService, ClientProvisioningSynchronizer, ClientProvisioningValidator, ClientRoleService, ClientScopeService, ClientService, CredentialsAuthenticator, GraphProvisioningSynchronizer, IDENTITY_PROVIDER_LDAP_COLLECTION_AUTHENTICATOR_TOKEN, IdentityGrantType, IdentityPermissionProvider, IdentityProviderAccountBaseMapper, IdentityProviderAccountManager, IdentityProviderAttributeMapper, IdentityProviderFacebookAuthenticator, IdentityProviderGithubAuthenticator, IdentityProviderGoogleAuthenticator, IdentityProviderInstagramAuthenticator, IdentityProviderLdapAuthenticator, IdentityProviderLdapCollectionAuthenticator, IdentityProviderMapperOperation, IdentityProviderOAuth2Authenticator, IdentityProviderOpenIDAuthenticator, IdentityProviderPaypalAuthenticator, IdentityProviderPermissionMapper, IdentityProviderRoleMapper, IdentityProviderRoleMappingService, IdentityResolver, IdentityRoleProvider, OAuth2AccessTokenIssuer, OAuth2Authorization, OAuth2AuthorizationCodeIssuer, OAuth2AuthorizationCodeRequestValidator, OAuth2AuthorizationCodeRequestVerifier, OAuth2AuthorizationCodeVerifier, OAuth2AuthorizationStateManager, OAuth2AuthorizeGrant, OAuth2OpenIDClaimsBuilder, OAuth2OpenIDTokenIssuer, OAuth2RefreshTokenGrant, OAuth2RefreshTokenIssuer, OAuth2ScopeAttributesResolver, OAuth2TokenRevoker, OAuth2TokenSigner, OAuth2TokenVerifier, PasswordGrantType, PasswordRecoveryService, PermissionBindingPolicyEvaluator, PermissionPolicyService, PermissionProvisioningSynchronizer, PermissionProvisioningValidator, PermissionService, PolicyEngine, PolicyProvisioningSynchronizer, PolicyService, ProvisioningEntityResolver, ProvisioningEntityStrategyType, ProvisioningJunctionSynchronizer, ProvisioningStrategyValidator, RealmProvisioningSynchronizer, RealmProvisioningValidator, RealmService, RegistrationService, RobotAuthenticator, RobotCredentialsGrant, RobotCredentialsService, RobotPermissionService, RobotProvisioningSynchronizer, RobotProvisioningValidator, RobotRoleService, RobotService, RoleAttributeService, RolePermissionService, RoleProvisioningSynchronizer, RoleProvisioningValidator, RoleService, RootProvisioningValidator, ScopeProvisioningSynchronizer, ScopeProvisioningValidator, ScopeService, SessionManager, UserAttributeService, UserAuthenticator, UserCredentialsService, UserPermissionService, UserProvisioningSynchronizer, UserProvisioningValidator, UserRoleService, UserService, base64URLEncode, buildOAuth2BearerTokenResponse, buildOAuth2CodeChallenge, buildOAuth2TokenHash, createIdentityProviderOAuth2Authenticator, generateOAuth2CodeVerifier, normalizeEntityProvisioningStrategy };
106
+ export { AbstractEntityService, BaseCredentialsAuthenticator, ClientAuthenticator, ClientCredentialsGrant, ClientCredentialsService, ClientPermissionService, ClientProvisioningSynchronizer, ClientProvisioningValidator, ClientRoleService, ClientScopeService, ClientService, CredentialsAuthenticator, GraphProvisioningSynchronizer, IDENTITY_PROVIDER_LDAP_COLLECTION_AUTHENTICATOR_TOKEN, IdentityGrantType, IdentityPermissionProvider, IdentityProviderAccountBaseMapper, IdentityProviderAccountManager, IdentityProviderAttributeMapper, IdentityProviderFacebookAuthenticator, IdentityProviderGithubAuthenticator, IdentityProviderGoogleAuthenticator, IdentityProviderInstagramAuthenticator, IdentityProviderLdapAuthenticator, IdentityProviderLdapCollectionAuthenticator, IdentityProviderMapperOperation, IdentityProviderOAuth2Authenticator, IdentityProviderOpenIDAuthenticator, IdentityProviderPaypalAuthenticator, IdentityProviderPermissionMapper, IdentityProviderRoleMapper, IdentityProviderRoleMappingService, IdentityResolver, IdentityRoleProvider, OAuth2AccessTokenIssuer, OAuth2Authorization, OAuth2AuthorizationCodeIssuer, OAuth2AuthorizationCodeRequestValidator, OAuth2AuthorizationCodeRequestVerifier, OAuth2AuthorizationCodeVerifier, OAuth2AuthorizationStateManager, OAuth2AuthorizeGrant, OAuth2ClientAuthenticator, OAuth2OpenIDClaimsBuilder, OAuth2OpenIDTokenIssuer, OAuth2RefreshTokenGrant, OAuth2RefreshTokenIssuer, OAuth2ScopeAttributesResolver, OAuth2TokenRevoker, OAuth2TokenSigner, OAuth2TokenVerifier, PasswordGrantType, PasswordRecoveryService, PermissionBindingPolicyEvaluator, PermissionPolicyService, PermissionProvisioningSynchronizer, PermissionProvisioningValidator, PermissionService, PolicyEngine, PolicyProvisioningSynchronizer, PolicyService, ProvisioningEntityResolver, ProvisioningEntityStrategyType, ProvisioningJunctionSynchronizer, ProvisioningStrategyValidator, RealmProvisioningSynchronizer, RealmProvisioningValidator, RealmService, RegistrationService, RobotAuthenticator, RobotCredentialsGrant, RobotCredentialsService, RobotPermissionService, RobotProvisioningSynchronizer, RobotProvisioningValidator, RobotRoleService, RobotService, RoleAttributeService, RolePermissionService, RoleProvisioningSynchronizer, RoleProvisioningValidator, RoleService, RootProvisioningValidator, ScopeProvisioningSynchronizer, ScopeProvisioningValidator, ScopeService, SessionManager, UserAttributeService, UserAuthenticator, UserCredentialsService, UserPermissionService, UserProvisioningSynchronizer, UserProvisioningValidator, UserRoleService, UserService, base64URLEncode, buildOAuth2BearerTokenResponse, buildOAuth2CodeChallenge, buildOAuth2TokenHash, createIdentityProviderOAuth2Authenticator, generateOAuth2CodeVerifier, normalizeEntityProvisioningStrategy };
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/core/oauth2/authorization/code/verifier/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAIhE,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,KAAK,EAAE,gCAAgC,EAAE,qCAAqC,EAAE,MAAM,YAAY,CAAC;AAE1G,qBAAa,+BAAgC,YAAW,gCAAgC;IACpF,SAAS,CAAC,UAAU,EAAG,kCAAkC,CAAC;gBAE9C,UAAU,EAAE,kCAAkC;IAIpD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,qCAAqC,GAAI,OAAO,CAAC,uBAAuB,CAAC;CA+BhH"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/core/oauth2/authorization/code/verifier/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAIhE,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,KAAK,EAAE,gCAAgC,EAAE,qCAAqC,EAAE,MAAM,YAAY,CAAC;AAE1G,qBAAa,+BAAgC,YAAW,gCAAgC;IACpF,SAAS,CAAC,UAAU,EAAG,kCAAkC,CAAC;gBAE9C,UAAU,EAAE,kCAAkC;IAIpD,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,qCAAqC,GAAI,OAAO,CAAC,uBAAuB,CAAC;CAiDhH"}
@@ -9,14 +9,18 @@ var OAuth2AuthorizationCodeVerifier = class {
9
9
  async verify(code, options) {
10
10
  const entity = await this.repository.popOneById(code);
11
11
  if (!entity) throw OAuth2Error.grantInvalid();
12
+ if (entity.client_id) {
13
+ if (!options.clientId || options.clientId !== entity.client_id) throw OAuth2Error.grantInvalid();
14
+ }
12
15
  if (entity.redirect_uri) {
13
16
  if (!options.redirectUri || entity.redirect_uri !== options.redirectUri) throw OAuth2Error.redirectUriMismatch();
14
17
  }
15
- if (entity.code_challenge) if (entity.code_challenge_method === OAuth2AuthorizationCodeChallengeMethod.PLAIN) {
16
- if (options.codeVerifier !== entity.code_challenge) throw OAuth2Error.grantInvalid("PKCE code_verifier mismatch.");
17
- } else {
18
+ if (options.clientIsPublic && !entity.code_challenge) throw OAuth2Error.grantInvalid("PKCE is required for public clients.");
19
+ if (entity.code_challenge) {
18
20
  if (!options.codeVerifier) throw OAuth2Error.grantInvalid("Code verifier invalid.");
19
- if (await buildOAuth2CodeChallenge(options.codeVerifier) !== entity.code_challenge) throw OAuth2Error.grantInvalid("PKCE code_verifier mismatch.");
21
+ if (entity.code_challenge_method === OAuth2AuthorizationCodeChallengeMethod.SHA_256) {
22
+ if (await buildOAuth2CodeChallenge(options.codeVerifier) !== entity.code_challenge) throw OAuth2Error.grantInvalid("PKCE code_verifier mismatch.");
23
+ } else if (options.codeVerifier !== entity.code_challenge) throw OAuth2Error.grantInvalid("PKCE code_verifier mismatch.");
20
24
  }
21
25
  return entity;
22
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"module.mjs","names":["OAuth2AuthorizationCodeChallengeMethod","OAuth2Error","buildOAuth2CodeChallenge","OAuth2AuthorizationCodeVerifier","repository","verify","code","options","entity","popOneById","grantInvalid","redirect_uri","redirectUri","redirectUriMismatch","code_challenge","code_challenge_method","PLAIN","codeVerifier","codeVerifierHash"],"sources":["../../../../../../src/core/oauth2/authorization/code/verifier/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2AuthorizationCode } from '@authup/core-kit';\nimport { OAuth2AuthorizationCodeChallengeMethod, OAuth2Error } from '@authup/specs';\nimport { buildOAuth2CodeChallenge } from '../../helpers.ts';\n\nimport type { IOAuth2AuthorizationCodeRepository } from '../repository/index.ts';\nimport type { IOAuth2AuthorizationCodeVerifier, IOAuth2AuthorizationCodeVerifyOptions } from './types.ts';\n\nexport class OAuth2AuthorizationCodeVerifier implements IOAuth2AuthorizationCodeVerifier {\n protected repository : IOAuth2AuthorizationCodeRepository;\n\n constructor(repository: IOAuth2AuthorizationCodeRepository) {\n this.repository = repository;\n }\n\n async verify(code: string, options: IOAuth2AuthorizationCodeVerifyOptions) : Promise<OAuth2AuthorizationCode> {\n const entity = await this.repository.popOneById(code);\n if (!entity) {\n throw OAuth2Error.grantInvalid();\n }\n\n if (entity.redirect_uri) {\n if (!options.redirectUri || entity.redirect_uri !== options.redirectUri) {\n throw OAuth2Error.redirectUriMismatch();\n }\n }\n\n if (entity.code_challenge) {\n if (entity.code_challenge_method === OAuth2AuthorizationCodeChallengeMethod.PLAIN) {\n if (options.codeVerifier !== entity.code_challenge) {\n throw OAuth2Error.grantInvalid('PKCE code_verifier mismatch.');\n }\n } else {\n if (!options.codeVerifier) {\n throw OAuth2Error.grantInvalid('Code verifier invalid.');\n }\n\n const codeVerifierHash = await buildOAuth2CodeChallenge(options.codeVerifier);\n if (codeVerifierHash !== entity.code_challenge) {\n throw OAuth2Error.grantInvalid('PKCE code_verifier mismatch.');\n }\n }\n }\n\n return entity;\n }\n}\n"],"mappings":";;;AAcA,IAAaG,kCAAb,MAAaA;CACCC;CAEV,YAAYA,YAAgD;AACxD,OAAKA,aAAaA;;CAGtB,MAAMC,OAAOC,MAAcC,SAAmF;EAC1G,MAAMC,SAAS,MAAM,KAAKJ,WAAWK,WAAWH,KAAAA;AAChD,MAAI,CAACE,OACD,OAAMP,YAAYS,cAAY;AAGlC,MAAIF,OAAOG;OACH,CAACJ,QAAQK,eAAeJ,OAAOG,iBAAiBJ,QAAQK,YACxD,OAAMX,YAAYY,qBAAmB;;AAI7C,MAAIL,OAAOM,eACP,KAAIN,OAAOO,0BAA0Bf,uCAAuCgB;OACpET,QAAQU,iBAAiBT,OAAOM,eAChC,OAAMb,YAAYS,aAAa,+BAAA;SAEhC;AACH,OAAI,CAACH,QAAQU,aACT,OAAMhB,YAAYS,aAAa,yBAAA;AAInC,OAAIQ,MAD2BhB,yBAAyBK,QAAQU,aAAY,KACnDT,OAAOM,eAC5B,OAAMb,YAAYS,aAAa,+BAAA;;AAK3C,SAAOF"}
1
+ {"version":3,"file":"module.mjs","names":["OAuth2AuthorizationCodeChallengeMethod","OAuth2Error","buildOAuth2CodeChallenge","OAuth2AuthorizationCodeVerifier","repository","verify","code","options","entity","popOneById","grantInvalid","client_id","clientId","redirect_uri","redirectUri","redirectUriMismatch","clientIsPublic","code_challenge","codeVerifier","code_challenge_method","SHA_256","codeVerifierHash"],"sources":["../../../../../../src/core/oauth2/authorization/code/verifier/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2AuthorizationCode } from '@authup/core-kit';\nimport { OAuth2AuthorizationCodeChallengeMethod, OAuth2Error } from '@authup/specs';\nimport { buildOAuth2CodeChallenge } from '../../helpers.ts';\n\nimport type { IOAuth2AuthorizationCodeRepository } from '../repository/index.ts';\nimport type { IOAuth2AuthorizationCodeVerifier, IOAuth2AuthorizationCodeVerifyOptions } from './types.ts';\n\nexport class OAuth2AuthorizationCodeVerifier implements IOAuth2AuthorizationCodeVerifier {\n protected repository : IOAuth2AuthorizationCodeRepository;\n\n constructor(repository: IOAuth2AuthorizationCodeRepository) {\n this.repository = repository;\n }\n\n async verify(code: string, options: IOAuth2AuthorizationCodeVerifyOptions) : Promise<OAuth2AuthorizationCode> {\n const entity = await this.repository.popOneById(code);\n if (!entity) {\n throw OAuth2Error.grantInvalid();\n }\n\n // RFC 6749 §4.1.3: if the client was issued a client_id, verify the\n // authorization code was issued to the authenticated client. Always\n // require a clientId to be supplied so a malformed token request can't\n // bypass the binding by omitting it.\n if (entity.client_id) {\n if (!options.clientId || options.clientId !== entity.client_id) {\n throw OAuth2Error.grantInvalid();\n }\n }\n\n if (entity.redirect_uri) {\n if (!options.redirectUri || entity.redirect_uri !== options.redirectUri) {\n throw OAuth2Error.redirectUriMismatch();\n }\n }\n\n // Public clients MUST use PKCE (RFC 7636). Defense in depth in case\n // the authorize-side check was bypassed or the client's\n // is_confidential flag changed between authorize and token.\n if (options.clientIsPublic && !entity.code_challenge) {\n throw OAuth2Error.grantInvalid('PKCE is required for public clients.');\n }\n\n if (entity.code_challenge) {\n if (!options.codeVerifier) {\n throw OAuth2Error.grantInvalid('Code verifier invalid.');\n }\n\n // RFC 7636 §4.3: code_challenge_method defaults to \"plain\" when\n // absent. Only treat the challenge as S256 when the client\n // explicitly sent code_challenge_method=S256.\n if (entity.code_challenge_method === OAuth2AuthorizationCodeChallengeMethod.SHA_256) {\n const codeVerifierHash = await buildOAuth2CodeChallenge(options.codeVerifier);\n if (codeVerifierHash !== entity.code_challenge) {\n throw OAuth2Error.grantInvalid('PKCE code_verifier mismatch.');\n }\n } else if (options.codeVerifier !== entity.code_challenge) {\n throw OAuth2Error.grantInvalid('PKCE code_verifier mismatch.');\n }\n }\n\n return entity;\n }\n}\n"],"mappings":";;;AAcA,IAAaG,kCAAb,MAAaA;CACCC;CAEV,YAAYA,YAAgD;AACxD,OAAKA,aAAaA;;CAGtB,MAAMC,OAAOC,MAAcC,SAAmF;EAC1G,MAAMC,SAAS,MAAM,KAAKJ,WAAWK,WAAWH,KAAAA;AAChD,MAAI,CAACE,OACD,OAAMP,YAAYS,cAAY;AAOlC,MAAIF,OAAOG;OACH,CAACJ,QAAQK,YAAYL,QAAQK,aAAaJ,OAAOG,UACjD,OAAMV,YAAYS,cAAY;;AAItC,MAAIF,OAAOK;OACH,CAACN,QAAQO,eAAeN,OAAOK,iBAAiBN,QAAQO,YACxD,OAAMb,YAAYc,qBAAmB;;AAO7C,MAAIR,QAAQS,kBAAkB,CAACR,OAAOS,eAClC,OAAMhB,YAAYS,aAAa,uCAAA;AAGnC,MAAIF,OAAOS,gBAAgB;AACvB,OAAI,CAACV,QAAQW,aACT,OAAMjB,YAAYS,aAAa,yBAAA;AAMnC,OAAIF,OAAOW,0BAA0BnB,uCAAuCoB;QAEpEC,MAD2BnB,yBAAyBK,QAAQW,aAAY,KACnDV,OAAOS,eAC5B,OAAMhB,YAAYS,aAAa,+BAAA;cAE5BH,QAAQW,iBAAiBV,OAAOS,eACvC,OAAMhB,YAAYS,aAAa,+BAAA;;AAIvC,SAAOF"}
@@ -2,6 +2,8 @@ import type { OAuth2AuthorizationCode } from '@authup/core-kit';
2
2
  export type IOAuth2AuthorizationCodeVerifyOptions = {
3
3
  redirectUri?: string;
4
4
  codeVerifier?: string;
5
+ clientId?: string;
6
+ clientIsPublic?: boolean;
5
7
  };
6
8
  export interface IOAuth2AuthorizationCodeVerifier {
7
9
  verify(code: string, options: IOAuth2AuthorizationCodeVerifyOptions): Promise<OAuth2AuthorizationCode>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/core/oauth2/authorization/code/verifier/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,MAAM,MAAM,qCAAqC,GAAG;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;CACxB,CAAC;AAEF,MAAM,WAAW,gCAAgC;IAC7C,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,qCAAqC,GAAI,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC3G"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/core/oauth2/authorization/code/verifier/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEhE,MAAM,MAAM,qCAAqC,GAAG;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,gCAAgC;IAC7C,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,qCAAqC,GAAI,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC3G"}
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/core/oauth2/authorization/code-request/verifier/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAIvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EACR,uCAAuC,EACvC,gDAAgD,EAChD,6CAA6C,EAChD,MAAM,YAAY,CAAC;AAEpB,qBAAa,sCAAuC,YAAW,uCAAuC;IAClG,SAAS,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;IAEpD,SAAS,CAAC,eAAe,EAAE,sBAAsB,CAAC;gBAEtC,GAAG,EAAE,6CAA6C;IAK9D;;;OAGG;IACG,MAAM,CACR,IAAI,EAAE,8BAA8B,GACpC,OAAO,CAAC,gDAAgD,CAAC;CA4ChE"}
1
+ {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../../../../src/core/oauth2/authorization/code-request/verifier/module.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,kBAAkB,CAAC;AAQvE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,KAAK,EACR,uCAAuC,EACvC,gDAAgD,EAChD,6CAA6C,EAChD,MAAM,YAAY,CAAC;AASpB,qBAAa,sCAAuC,YAAW,uCAAuC;IAClG,SAAS,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;IAEpD,SAAS,CAAC,eAAe,EAAE,sBAAsB,CAAC;gBAEtC,GAAG,EAAE,6CAA6C;IAK9D;;;OAGG;IACG,MAAM,CACR,IAAI,EAAE,8BAA8B,GACpC,OAAO,CAAC,gDAAgD,CAAC;CA6DhE"}
@@ -1,7 +1,11 @@
1
1
  import { ScopeName } from "@authup/core-kit";
2
2
  import { isSimpleMatch } from "@authup/kit";
3
- import { OAuth2Error, hasOAuth2Scopes } from "@authup/specs";
3
+ import { OAuth2AuthorizationResponseType, OAuth2Error, hasOAuth2Scopes } from "@authup/specs";
4
4
  //#region src/core/oauth2/authorization/code-request/verifier/module.ts
5
+ function willIssueCode(responseType) {
6
+ if (!responseType) return false;
7
+ return responseType.split(" ").includes(OAuth2AuthorizationResponseType.CODE);
8
+ }
5
9
  var OAuth2AuthorizationCodeRequestVerifier = class {
6
10
  clientRepository;
7
11
  scopeRepository;
@@ -17,6 +21,8 @@ var OAuth2AuthorizationCodeRequestVerifier = class {
17
21
  const client = await this.clientRepository.findOneByIdOrName(data.client_id, data.realm_id);
18
22
  if (!client) throw OAuth2Error.clientInvalid();
19
23
  if (!client.active) throw OAuth2Error.clientInactive();
24
+ if (!client.is_confidential && !data.code_challenge && willIssueCode(data.response_type)) throw OAuth2Error.requestInvalid("PKCE code_challenge is required for public clients.");
25
+ if (!client.is_confidential && !data.state && willIssueCode(data.response_type)) throw OAuth2Error.requestInvalid("state is required for public clients in the code flow.");
20
26
  data.client_id = client.id;
21
27
  data.realm_id = client.realm_id;
22
28
  const scopes = await this.scopeRepository.findByClientId(client.id);
@@ -1 +1 @@
1
- {"version":3,"file":"module.mjs","names":["ScopeName","isSimpleMatch","OAuth2Error","hasOAuth2Scopes","OAuth2AuthorizationCodeRequestVerifier","clientRepository","scopeRepository","ctx","verify","data","client_id","clientInvalid","client","findOneByIdOrName","realm_id","active","clientInactive","id","scopes","findByClientId","scopeNames","map","scope","name","GLOBAL","scopeInsufficient","join","redirect_uri","redirectUris","split","redirectUriMismatch"],"sources":["../../../../../../src/core/oauth2/authorization/code-request/verifier/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2AuthorizationCodeRequest } from '@authup/core-kit';\nimport { ScopeName } from '@authup/core-kit';\nimport { isSimpleMatch } from '@authup/kit';\nimport { OAuth2Error, hasOAuth2Scopes } from '@authup/specs';\nimport type { IOAuth2ClientRepository } from '../../../client/index.ts';\nimport type { IOAuth2ScopeRepository } from '../../../scope/index.ts';\nimport type {\n IOAuth2AuthorizationCodeRequestVerifier,\n OAuth2AuthorizationCodeRequestVerificationResult,\n OAuth2AuthorizationCodeRequestVerifierContext,\n} from './types.ts';\n\nexport class OAuth2AuthorizationCodeRequestVerifier implements IOAuth2AuthorizationCodeRequestVerifier {\n protected clientRepository: IOAuth2ClientRepository;\n\n protected scopeRepository: IOAuth2ScopeRepository;\n\n constructor(ctx: OAuth2AuthorizationCodeRequestVerifierContext) {\n this.clientRepository = ctx.clientRepository;\n this.scopeRepository = ctx.scopeRepository;\n }\n\n /**\n * Verify validated authorization code request.\n * @param data\n */\n async verify(\n data: OAuth2AuthorizationCodeRequest,\n ) : Promise<OAuth2AuthorizationCodeRequestVerificationResult> {\n if (!data.client_id) {\n throw OAuth2Error.clientInvalid();\n }\n\n const client = await this.clientRepository.findOneByIdOrName(data.client_id, data.realm_id);\n if (!client) {\n throw OAuth2Error.clientInvalid();\n }\n\n if (!client.active) {\n throw OAuth2Error.clientInactive();\n }\n\n data.client_id = client.id;\n data.realm_id = client.realm_id;\n\n const scopes = await this.scopeRepository.findByClientId(client.id);\n const scopeNames = scopes.map((scope) => scope.name);\n if (data.scope) {\n if (\n !hasOAuth2Scopes(scopeNames, data.scope) &&\n !hasOAuth2Scopes(data.scope, ScopeName.GLOBAL)\n ) {\n throw OAuth2Error.scopeInsufficient();\n }\n } else {\n data.scope = scopeNames.join(' ');\n }\n\n if (client.redirect_uri && data.redirect_uri) {\n const redirectUris = client.redirect_uri.split(',');\n\n if (!isSimpleMatch(data.redirect_uri, redirectUris)) {\n throw OAuth2Error.redirectUriMismatch();\n }\n }\n\n return {\n data,\n client,\n scopes,\n };\n }\n}\n"],"mappings":";;;;AAmBA,IAAaI,yCAAb,MAAaA;CACCC;CAEAC;CAEV,YAAYC,KAAoD;AAC5D,OAAKF,mBAAmBE,IAAIF;AAC5B,OAAKC,kBAAkBC,IAAID;;;;;IAO/B,MAAME,OACFC,MAC0D;AAC1D,MAAI,CAACA,KAAKC,UACN,OAAMR,YAAYS,eAAa;EAGnC,MAAMC,SAAS,MAAM,KAAKP,iBAAiBQ,kBAAkBJ,KAAKC,WAAWD,KAAKK,SAAQ;AAC1F,MAAI,CAACF,OACD,OAAMV,YAAYS,eAAa;AAGnC,MAAI,CAACC,OAAOG,OACR,OAAMb,YAAYc,gBAAc;AAGpCP,OAAKC,YAAYE,OAAOK;AACxBR,OAAKK,WAAWF,OAAOE;EAEvB,MAAMI,SAAS,MAAM,KAAKZ,gBAAgBa,eAAeP,OAAOK,GAAE;EAClE,MAAMG,aAAaF,OAAOG,KAAKC,UAAUA,MAAMC,KAAI;AACnD,MAAId,KAAKa;OAED,CAACnB,gBAAgBiB,YAAYX,KAAKa,MAAK,IACvC,CAACnB,gBAAgBM,KAAKa,OAAOtB,UAAUwB,OAAM,CAE7C,OAAMtB,YAAYuB,mBAAiB;QAGvChB,MAAKa,QAAQF,WAAWM,KAAK,IAAA;AAGjC,MAAId,OAAOe,gBAAgBlB,KAAKkB,cAAc;GAC1C,MAAMC,eAAehB,OAAOe,aAAaE,MAAM,IAAA;AAE/C,OAAI,CAAC5B,cAAcQ,KAAKkB,cAAcC,aAAAA,CAClC,OAAM1B,YAAY4B,qBAAmB;;AAI7C,SAAO;GACHrB;GACAG;GACAM;GACJ"}
1
+ {"version":3,"file":"module.mjs","names":["ScopeName","isSimpleMatch","OAuth2AuthorizationResponseType","OAuth2Error","hasOAuth2Scopes","willIssueCode","responseType","split","includes","CODE","OAuth2AuthorizationCodeRequestVerifier","clientRepository","scopeRepository","ctx","verify","data","client_id","clientInvalid","client","findOneByIdOrName","realm_id","active","clientInactive","is_confidential","code_challenge","response_type","requestInvalid","state","id","scopes","findByClientId","scopeNames","map","scope","name","GLOBAL","scopeInsufficient","join","redirect_uri","redirectUris","redirectUriMismatch"],"sources":["../../../../../../src/core/oauth2/authorization/code-request/verifier/module.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2AuthorizationCodeRequest } from '@authup/core-kit';\nimport { ScopeName } from '@authup/core-kit';\nimport { isSimpleMatch } from '@authup/kit';\nimport {\n OAuth2AuthorizationResponseType,\n OAuth2Error,\n hasOAuth2Scopes,\n} from '@authup/specs';\nimport type { IOAuth2ClientRepository } from '../../../client/index.ts';\nimport type { IOAuth2ScopeRepository } from '../../../scope/index.ts';\nimport type {\n IOAuth2AuthorizationCodeRequestVerifier,\n OAuth2AuthorizationCodeRequestVerificationResult,\n OAuth2AuthorizationCodeRequestVerifierContext,\n} from './types.ts';\n\nfunction willIssueCode(responseType: string | undefined): boolean {\n if (!responseType) {\n return false;\n }\n return responseType.split(' ').includes(OAuth2AuthorizationResponseType.CODE);\n}\n\nexport class OAuth2AuthorizationCodeRequestVerifier implements IOAuth2AuthorizationCodeRequestVerifier {\n protected clientRepository: IOAuth2ClientRepository;\n\n protected scopeRepository: IOAuth2ScopeRepository;\n\n constructor(ctx: OAuth2AuthorizationCodeRequestVerifierContext) {\n this.clientRepository = ctx.clientRepository;\n this.scopeRepository = ctx.scopeRepository;\n }\n\n /**\n * Verify validated authorization code request.\n * @param data\n */\n async verify(\n data: OAuth2AuthorizationCodeRequest,\n ) : Promise<OAuth2AuthorizationCodeRequestVerificationResult> {\n if (!data.client_id) {\n throw OAuth2Error.clientInvalid();\n }\n\n const client = await this.clientRepository.findOneByIdOrName(data.client_id, data.realm_id);\n if (!client) {\n throw OAuth2Error.clientInvalid();\n }\n\n if (!client.active) {\n throw OAuth2Error.clientInactive();\n }\n\n // Public clients MUST use PKCE for the code flow (RFC 7636 §4.4.1,\n // OAuth 2.1). Without PKCE a public client's code flow has no second\n // factor — anyone who intercepts the redirect can redeem the code at\n // /token. Only enforce when an authorization code will actually be\n // issued; implicit/id_token-only flows don't involve a code.\n if (!client.is_confidential && !data.code_challenge && willIssueCode(data.response_type)) {\n throw OAuth2Error.requestInvalid('PKCE code_challenge is required for public clients.');\n }\n\n // Public clients SHOULD include state to bind the redirect to the\n // initiating session and prevent CSRF (RFC 6749 §10.12). Confidential\n // clients are exempt because the /token exchange already authenticates\n // them via client_secret.\n if (!client.is_confidential && !data.state && willIssueCode(data.response_type)) {\n throw OAuth2Error.requestInvalid('state is required for public clients in the code flow.');\n }\n\n data.client_id = client.id;\n data.realm_id = client.realm_id;\n\n const scopes = await this.scopeRepository.findByClientId(client.id);\n const scopeNames = scopes.map((scope) => scope.name);\n if (data.scope) {\n if (\n !hasOAuth2Scopes(scopeNames, data.scope) &&\n !hasOAuth2Scopes(data.scope, ScopeName.GLOBAL)\n ) {\n throw OAuth2Error.scopeInsufficient();\n }\n } else {\n data.scope = scopeNames.join(' ');\n }\n\n if (client.redirect_uri && data.redirect_uri) {\n const redirectUris = client.redirect_uri.split(',');\n\n if (!isSimpleMatch(data.redirect_uri, redirectUris)) {\n throw OAuth2Error.redirectUriMismatch();\n }\n }\n\n return {\n data,\n client,\n scopes,\n };\n }\n}\n"],"mappings":";;;;AAuBA,SAASK,cAAcC,cAAgC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AcC,aAAAA,CAClC,OAAMpC,YAAYqC,qBAAmB;;AAI7C,SAAO;GACHzB;GACAG;GACAW;GACJ"}
@@ -0,0 +1,17 @@
1
+ import type { Client } from '@authup/core-kit';
2
+ import { ClientCredentialsService } from '../../authentication/credential/index.ts';
3
+ import type { IIdentityResolver } from '../../identity/index.ts';
4
+ /**
5
+ * Authenticates a client at the OAuth2 token endpoint. Confidential clients
6
+ * MUST present a valid client_secret (RFC 6749 §3.2.1, §4.1.3, §4.3.2, §6);
7
+ * public clients identify via client_id only.
8
+ *
9
+ * Used by authorization_code, refresh_token, and password grants.
10
+ */
11
+ export declare class OAuth2ClientAuthenticator {
12
+ protected identityResolver: IIdentityResolver;
13
+ protected credentialsService: ClientCredentialsService;
14
+ constructor(identityResolver: IIdentityResolver);
15
+ authenticate(clientId: string | undefined, clientSecret?: string, realmId?: string): Promise<Client>;
16
+ }
17
+ //# sourceMappingURL=authenticator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticator.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/client/authenticator.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;;GAMG;AACH,qBAAa,yBAAyB;IAClC,SAAS,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;IAE9C,SAAS,CAAC,kBAAkB,EAAE,wBAAwB,CAAC;gBAE3C,gBAAgB,EAAE,iBAAiB;IAKzC,YAAY,CACd,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;CA2BrB"}
@@ -0,0 +1,34 @@
1
+ import { ClientCredentialsService } from "../../authentication/credential/entities/client/module.mjs";
2
+ import "../../authentication/credential/index.mjs";
3
+ import { IdentityType } from "@authup/core-kit";
4
+ import { OAuth2Error } from "@authup/specs";
5
+ //#region src/core/oauth2/client/authenticator.ts
6
+ /**
7
+ * Authenticates a client at the OAuth2 token endpoint. Confidential clients
8
+ * MUST present a valid client_secret (RFC 6749 §3.2.1, §4.1.3, §4.3.2, §6);
9
+ * public clients identify via client_id only.
10
+ *
11
+ * Used by authorization_code, refresh_token, and password grants.
12
+ */ var OAuth2ClientAuthenticator = class {
13
+ identityResolver;
14
+ credentialsService;
15
+ constructor(identityResolver) {
16
+ this.identityResolver = identityResolver;
17
+ this.credentialsService = new ClientCredentialsService();
18
+ }
19
+ async authenticate(clientId, clientSecret, realmId) {
20
+ if (!clientId) throw OAuth2Error.clientInvalid();
21
+ const identity = await this.identityResolver.resolve(IdentityType.CLIENT, clientId, realmId);
22
+ if (!identity || identity.type !== IdentityType.CLIENT) throw OAuth2Error.clientInvalid();
23
+ if (!identity.data.active) throw OAuth2Error.clientInactive();
24
+ if (identity.data.is_confidential) {
25
+ if (!clientSecret) throw OAuth2Error.clientInvalid();
26
+ if (!await this.credentialsService.verify(clientSecret, identity.data)) throw OAuth2Error.clientInvalid();
27
+ }
28
+ return identity.data;
29
+ }
30
+ };
31
+ //#endregion
32
+ export { OAuth2ClientAuthenticator };
33
+
34
+ //# sourceMappingURL=authenticator.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticator.mjs","names":["IdentityType","OAuth2Error","ClientCredentialsService","OAuth2ClientAuthenticator","identityResolver","credentialsService","authenticate","clientId","clientSecret","realmId","clientInvalid","identity","resolve","CLIENT","type","data","active","clientInactive","is_confidential","verified","verify"],"sources":["../../../../src/core/oauth2/client/authenticator.ts"],"sourcesContent":["/*\n * Copyright (c) 2025-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { Client } from '@authup/core-kit';\nimport { IdentityType } from '@authup/core-kit';\nimport { OAuth2Error } from '@authup/specs';\nimport { ClientCredentialsService } from '../../authentication/credential/index.ts';\nimport type { IIdentityResolver } from '../../identity/index.ts';\n\n/**\n * Authenticates a client at the OAuth2 token endpoint. Confidential clients\n * MUST present a valid client_secret (RFC 6749 §3.2.1, §4.1.3, §4.3.2, §6);\n * public clients identify via client_id only.\n *\n * Used by authorization_code, refresh_token, and password grants.\n */\nexport class OAuth2ClientAuthenticator {\n protected identityResolver: IIdentityResolver;\n\n protected credentialsService: ClientCredentialsService;\n\n constructor(identityResolver: IIdentityResolver) {\n this.identityResolver = identityResolver;\n this.credentialsService = new ClientCredentialsService();\n }\n\n async authenticate(\n clientId: string | undefined,\n clientSecret?: string,\n realmId?: string,\n ): Promise<Client> {\n if (!clientId) {\n throw OAuth2Error.clientInvalid();\n }\n\n const identity = await this.identityResolver.resolve(IdentityType.CLIENT, clientId, realmId);\n if (!identity || identity.type !== IdentityType.CLIENT) {\n throw OAuth2Error.clientInvalid();\n }\n\n if (!identity.data.active) {\n throw OAuth2Error.clientInactive();\n }\n\n if (identity.data.is_confidential) {\n if (!clientSecret) {\n throw OAuth2Error.clientInvalid();\n }\n\n const verified = await this.credentialsService.verify(clientSecret, identity.data);\n if (!verified) {\n throw OAuth2Error.clientInvalid();\n }\n }\n\n return identity.data;\n }\n}\n"],"mappings":";;;;;;;;;;;GAoBA,IAAaG,4BAAb,MAAaA;CACCC;CAEAC;CAEV,YAAYD,kBAAqC;AAC7C,OAAKA,mBAAmBA;AACxB,OAAKC,qBAAqB,IAAIH,0BAAAA;;CAGlC,MAAMI,aACFC,UACAC,cACAC,SACe;AACf,MAAI,CAACF,SACD,OAAMN,YAAYS,eAAa;EAGnC,MAAMC,WAAW,MAAM,KAAKP,iBAAiBQ,QAAQZ,aAAaa,QAAQN,UAAUE,QAAAA;AACpF,MAAI,CAACE,YAAYA,SAASG,SAASd,aAAaa,OAC5C,OAAMZ,YAAYS,eAAa;AAGnC,MAAI,CAACC,SAASI,KAAKC,OACf,OAAMf,YAAYgB,gBAAc;AAGpC,MAAIN,SAASI,KAAKG,iBAAiB;AAC/B,OAAI,CAACV,aACD,OAAMP,YAAYS,eAAa;AAInC,OAAI,CAACS,MADkB,KAAKd,mBAAmBe,OAAOZ,cAAcG,SAASI,KAAI,CAE7E,OAAMd,YAAYS,eAAa;;AAIvC,SAAOC,SAASI"}
@@ -1,2 +1,3 @@
1
+ export * from './authenticator.ts';
1
2
  export * from './types.ts';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/client/index.ts"],"names":[],"mappings":"AAOA,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/client/index.ts"],"names":[],"mappings":"AAOA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC"}
@@ -1 +1,2 @@
1
- export {};
1
+ import { OAuth2ClientAuthenticator } from "./authenticator.mjs";
2
+ export { OAuth2ClientAuthenticator };
@@ -1,11 +1,15 @@
1
1
  import type { OAuth2TokenGrantResponse } from '@authup/specs';
2
- import type { User } from '@authup/core-kit';
2
+ import type { Client, User } from '@authup/core-kit';
3
3
  import type { IOAuth2TokenIssuer } from '../token/index.ts';
4
4
  import { OAuth2BaseGrant } from './base.ts';
5
5
  import type { OAuth2GrantRunWIthOptions, OAuth2PasswordGrantContext } from './types.ts';
6
- export declare class PasswordGrantType extends OAuth2BaseGrant<User> {
6
+ export type OAuth2PasswordGrantInput = {
7
+ user: User;
8
+ client?: Client;
9
+ };
10
+ export declare class PasswordGrantType extends OAuth2BaseGrant<OAuth2PasswordGrantInput> {
7
11
  protected refreshTokenIssuer: IOAuth2TokenIssuer;
8
12
  constructor(ctx: OAuth2PasswordGrantContext);
9
- runWith(input: User, options?: OAuth2GrantRunWIthOptions): Promise<OAuth2TokenGrantResponse>;
13
+ runWith(input: OAuth2PasswordGrantInput, options?: OAuth2GrantRunWIthOptions): Promise<OAuth2TokenGrantResponse>;
10
14
  }
11
15
  //# sourceMappingURL=password.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/password.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAElF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAM7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExF,qBAAa,iBAAkB,SAAQ,eAAe,CAAC,IAAI,CAAC;IACxD,SAAS,CAAC,kBAAkB,EAAG,kBAAkB,CAAC;gBAEtC,GAAG,EAAE,0BAA0B;IASrC,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,GAAE,yBAA8B,GAAI,OAAO,CAAC,wBAAwB,CAAC;CAgC1G"}
1
+ {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../../../src/core/oauth2/grant-types/password.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,wBAAwB,EAAsB,MAAM,eAAe,CAAC;AAElF,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAMrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExF,MAAM,MAAM,wBAAwB,GAAG;IACnC,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,qBAAa,iBAAkB,SAAQ,eAAe,CAAC,wBAAwB,CAAC;IAC5E,SAAS,CAAC,kBAAkB,EAAG,kBAAkB,CAAC;gBAEtC,GAAG,EAAE,0BAA0B;IASrC,OAAO,CAAC,KAAK,EAAE,wBAAwB,EAAE,OAAO,GAAE,yBAA8B,GAAI,OAAO,CAAC,wBAAwB,CAAC;CAmC9H"}
@@ -13,24 +13,26 @@ var PasswordGrantType = class extends OAuth2BaseGrant {
13
13
  this.refreshTokenIssuer = ctx.refreshTokenIssuer;
14
14
  }
15
15
  async runWith(input, options = {}) {
16
+ const { user, client } = input;
17
+ const clientId = client?.id;
16
18
  const session = await this.sessionManager.create({
17
19
  user_agent: options.userAgent,
18
20
  ip_address: options.ipAddress,
19
- realm_id: input.realm_id,
20
- client_id: input.client_id || void 0,
21
- sub: input.id,
21
+ realm_id: user.realm_id,
22
+ client_id: clientId,
23
+ sub: user.id,
22
24
  sub_kind: IdentityType.USER
23
25
  });
24
26
  const issuePayload = {
25
- client_id: input.client_id || void 0,
27
+ client_id: clientId,
26
28
  session_id: session.id,
27
29
  user_agent: session.user_agent,
28
30
  remote_address: session.ip_address,
29
31
  scope: ScopeName.GLOBAL,
30
- sub: input.id,
32
+ sub: user.id,
31
33
  sub_kind: OAuth2SubKind.USER,
32
- realm_id: input.realm_id,
33
- realm_name: input.realm?.name
34
+ realm_id: user.realm_id,
35
+ realm_name: user.realm?.name
34
36
  };
35
37
  const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue(issuePayload);
36
38
  const [refreshToken, refreshTokenPayload] = await this.refreshTokenIssuer.issue(issuePayload);
@@ -1 +1 @@
1
- {"version":3,"file":"password.mjs","names":["OAuth2SubKind","IdentityType","ScopeName","buildOAuth2BearerTokenResponse","OAuth2BaseGrant","PasswordGrantType","refreshTokenIssuer","ctx","accessTokenIssuer","sessionManager","runWith","input","options","session","create","user_agent","userAgent","ip_address","ipAddress","realm_id","client_id","undefined","sub","id","sub_kind","USER","issuePayload","session_id","remote_address","scope","GLOBAL","realm_name","realm","name","accessToken","accessTokenPayload","issue","refreshToken","refreshTokenPayload"],"sources":["../../../../src/core/oauth2/grant-types/password.ts"],"sourcesContent":["/*\n * Copyright (c) 2022.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenGrantResponse, OAuth2TokenPayload } from '@authup/specs';\nimport { OAuth2SubKind } from '@authup/specs';\nimport type { User } from '@authup/core-kit';\nimport {\n IdentityType,\n ScopeName,\n} from '@authup/core-kit';\nimport { buildOAuth2BearerTokenResponse } from '../response/index.ts';\nimport type { IOAuth2TokenIssuer } from '../token/index.ts';\nimport { OAuth2BaseGrant } from './base.ts';\nimport type { OAuth2GrantRunWIthOptions, OAuth2PasswordGrantContext } from './types.ts';\n\nexport class PasswordGrantType extends OAuth2BaseGrant<User> {\n protected refreshTokenIssuer : IOAuth2TokenIssuer;\n\n constructor(ctx: OAuth2PasswordGrantContext) {\n super({\n accessTokenIssuer: ctx.accessTokenIssuer,\n sessionManager: ctx.sessionManager,\n });\n\n this.refreshTokenIssuer = ctx.refreshTokenIssuer;\n }\n\n async runWith(input: User, options: OAuth2GrantRunWIthOptions = {}) : Promise<OAuth2TokenGrantResponse> {\n const session = await this.sessionManager.create({\n user_agent: options.userAgent,\n ip_address: options.ipAddress,\n realm_id: input.realm_id,\n client_id: input.client_id || undefined,\n sub: input.id,\n sub_kind: IdentityType.USER,\n });\n\n const issuePayload : Partial<OAuth2TokenPayload> = {\n client_id: input.client_id || undefined,\n session_id: session.id,\n user_agent: session.user_agent,\n remote_address: session.ip_address,\n scope: ScopeName.GLOBAL,\n sub: input.id,\n sub_kind: OAuth2SubKind.USER,\n realm_id: input.realm_id,\n realm_name: input.realm?.name,\n };\n\n const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue(issuePayload);\n const [refreshToken, refreshTokenPayload] = await this.refreshTokenIssuer.issue(issuePayload);\n\n return buildOAuth2BearerTokenResponse({\n accessToken,\n accessTokenPayload,\n refreshToken,\n refreshTokenPayload,\n });\n }\n}\n"],"mappings":";;;;;AAmBA,IAAaK,oBAAb,cAAuCD,gBAAAA;CACzBE;CAEV,YAAYC,KAAiC;AACzC,QAAM;GACFC,mBAAmBD,IAAIC;GACvBC,gBAAgBF,IAAIE;GACxB,CAAA;AAEA,OAAKH,qBAAqBC,IAAID;;CAGlC,MAAMI,QAAQC,OAAaC,UAAqC,EAAE,EAAsC;EACpG,MAAMC,UAAU,MAAM,KAAKJ,eAAeK,OAAO;GAC7CC,YAAYH,QAAQI;GACpBC,YAAYL,QAAQM;GACpBC,UAAUR,MAAMQ;GAChBC,WAAWT,MAAMS,aAAaC,KAAAA;GAC9BC,KAAKX,MAAMY;GACXC,UAAUvB,aAAawB;GAC3B,CAAA;EAEA,MAAMC,eAA6C;GAC/CN,WAAWT,MAAMS,aAAaC,KAAAA;GAC9BM,YAAYd,QAAQU;GACpBR,YAAYF,QAAQE;GACpBa,gBAAgBf,QAAQI;GACxBY,OAAO3B,UAAU4B;GACjBR,KAAKX,MAAMY;GACXC,UAAUxB,cAAcyB;GACxBN,UAAUR,MAAMQ;GAChBY,YAAYpB,MAAMqB,OAAOC;GAC7B;EAEA,MAAM,CAACC,aAAaC,sBAAsB,MAAM,KAAK3B,kBAAkB4B,MAAMV,aAAAA;EAC7E,MAAM,CAACW,cAAcC,uBAAuB,MAAM,KAAKhC,mBAAmB8B,MAAMV,aAAAA;AAEhF,SAAOvB,+BAA+B;GAClC+B;GACAC;GACAE;GACAC;GACJ,CAAA"}
1
+ {"version":3,"file":"password.mjs","names":["OAuth2SubKind","IdentityType","ScopeName","buildOAuth2BearerTokenResponse","OAuth2BaseGrant","PasswordGrantType","refreshTokenIssuer","ctx","accessTokenIssuer","sessionManager","runWith","input","options","user","client","clientId","id","session","create","user_agent","userAgent","ip_address","ipAddress","realm_id","client_id","sub","sub_kind","USER","issuePayload","session_id","remote_address","scope","GLOBAL","realm_name","realm","name","accessToken","accessTokenPayload","issue","refreshToken","refreshTokenPayload"],"sources":["../../../../src/core/oauth2/grant-types/password.ts"],"sourcesContent":["/*\n * Copyright (c) 2022-2026.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenGrantResponse, OAuth2TokenPayload } from '@authup/specs';\nimport { OAuth2SubKind } from '@authup/specs';\nimport type { Client, User } from '@authup/core-kit';\nimport {\n IdentityType,\n ScopeName,\n} from '@authup/core-kit';\nimport { buildOAuth2BearerTokenResponse } from '../response/index.ts';\nimport type { IOAuth2TokenIssuer } from '../token/index.ts';\nimport { OAuth2BaseGrant } from './base.ts';\nimport type { OAuth2GrantRunWIthOptions, OAuth2PasswordGrantContext } from './types.ts';\n\nexport type OAuth2PasswordGrantInput = {\n user: User,\n client?: Client,\n};\n\nexport class PasswordGrantType extends OAuth2BaseGrant<OAuth2PasswordGrantInput> {\n protected refreshTokenIssuer : IOAuth2TokenIssuer;\n\n constructor(ctx: OAuth2PasswordGrantContext) {\n super({\n accessTokenIssuer: ctx.accessTokenIssuer,\n sessionManager: ctx.sessionManager,\n });\n\n this.refreshTokenIssuer = ctx.refreshTokenIssuer;\n }\n\n async runWith(input: OAuth2PasswordGrantInput, options: OAuth2GrantRunWIthOptions = {}) : Promise<OAuth2TokenGrantResponse> {\n const { user, client } = input;\n const clientId = client?.id;\n\n const session = await this.sessionManager.create({\n user_agent: options.userAgent,\n ip_address: options.ipAddress,\n realm_id: user.realm_id,\n client_id: clientId,\n sub: user.id,\n sub_kind: IdentityType.USER,\n });\n\n const issuePayload : Partial<OAuth2TokenPayload> = {\n client_id: clientId,\n session_id: session.id,\n user_agent: session.user_agent,\n remote_address: session.ip_address,\n scope: ScopeName.GLOBAL,\n sub: user.id,\n sub_kind: OAuth2SubKind.USER,\n realm_id: user.realm_id,\n realm_name: user.realm?.name,\n };\n\n const [accessToken, accessTokenPayload] = await this.accessTokenIssuer.issue(issuePayload);\n const [refreshToken, refreshTokenPayload] = await this.refreshTokenIssuer.issue(issuePayload);\n\n return buildOAuth2BearerTokenResponse({\n accessToken,\n accessTokenPayload,\n refreshToken,\n refreshTokenPayload,\n });\n }\n}\n"],"mappings":";;;;;AAwBA,IAAaK,oBAAb,cAAuCD,gBAAAA;CACzBE;CAEV,YAAYC,KAAiC;AACzC,QAAM;GACFC,mBAAmBD,IAAIC;GACvBC,gBAAgBF,IAAIE;GACxB,CAAA;AAEA,OAAKH,qBAAqBC,IAAID;;CAGlC,MAAMI,QAAQC,OAAiCC,UAAqC,EAAE,EAAsC;EACxH,MAAM,EAAEC,MAAMC,WAAWH;EACzB,MAAMI,WAAWD,QAAQE;EAEzB,MAAMC,UAAU,MAAM,KAAKR,eAAeS,OAAO;GAC7CC,YAAYP,QAAQQ;GACpBC,YAAYT,QAAQU;GACpBC,UAAUV,KAAKU;GACfC,WAAWT;GACXU,KAAKZ,KAAKG;GACVU,UAAUzB,aAAa0B;GAC3B,CAAA;EAEA,MAAMC,eAA6C;GAC/CJ,WAAWT;GACXc,YAAYZ,QAAQD;GACpBG,YAAYF,QAAQE;GACpBW,gBAAgBb,QAAQI;GACxBU,OAAO7B,UAAU8B;GACjBP,KAAKZ,KAAKG;GACVU,UAAU1B,cAAc2B;GACxBJ,UAAUV,KAAKU;GACfU,YAAYpB,KAAKqB,OAAOC;GAC5B;EAEA,MAAM,CAACC,aAAaC,sBAAsB,MAAM,KAAK7B,kBAAkB8B,MAAMV,aAAAA;EAC7E,MAAM,CAACW,cAAcC,uBAAuB,MAAM,KAAKlC,mBAAmBgC,MAAMV,aAAAA;AAEhF,SAAOzB,+BAA+B;GAClCiC;GACAC;GACAE;GACAC;GACJ,CAAA"}
@@ -6,6 +6,8 @@ import { OAuth2AuthorizationCodeRequestValidator } from "./authorization/code-re
6
6
  import { OAuth2AuthorizationStateManager } from "./authorization/state/module.mjs";
7
7
  import { OAuth2Authorization } from "./authorization/module.mjs";
8
8
  import "./authorization/index.mjs";
9
+ import { OAuth2ClientAuthenticator } from "./client/authenticator.mjs";
10
+ import "./client/index.mjs";
9
11
  import { buildOAuth2BearerTokenResponse } from "./response/bearer.mjs";
10
12
  import { OAuth2AuthorizeGrant } from "./grant-types/authorize.mjs";
11
13
  import { ClientCredentialsGrant } from "./grant-types/client-credentials.mjs";
@@ -25,4 +27,4 @@ import { OAuth2TokenRevoker } from "./token/revoker/module.mjs";
25
27
  import { OAuth2TokenSigner } from "./token/signer/module.mjs";
26
28
  import { OAuth2TokenVerifier } from "./token/verifier/module.mjs";
27
29
  import "./token/index.mjs";
28
- export { ClientCredentialsGrant, IdentityGrantType, OAuth2AccessTokenIssuer, OAuth2Authorization, OAuth2AuthorizationCodeIssuer, OAuth2AuthorizationCodeRequestValidator, OAuth2AuthorizationCodeRequestVerifier, OAuth2AuthorizationCodeVerifier, OAuth2AuthorizationStateManager, OAuth2AuthorizeGrant, OAuth2OpenIDClaimsBuilder, OAuth2OpenIDTokenIssuer, OAuth2RefreshTokenGrant, OAuth2RefreshTokenIssuer, OAuth2ScopeAttributesResolver, OAuth2TokenRevoker, OAuth2TokenSigner, OAuth2TokenVerifier, PasswordGrantType, RobotCredentialsGrant, base64URLEncode, buildOAuth2BearerTokenResponse, buildOAuth2CodeChallenge, buildOAuth2TokenHash, generateOAuth2CodeVerifier };
30
+ export { ClientCredentialsGrant, IdentityGrantType, OAuth2AccessTokenIssuer, OAuth2Authorization, OAuth2AuthorizationCodeIssuer, OAuth2AuthorizationCodeRequestValidator, OAuth2AuthorizationCodeRequestVerifier, OAuth2AuthorizationCodeVerifier, OAuth2AuthorizationStateManager, OAuth2AuthorizeGrant, OAuth2ClientAuthenticator, OAuth2OpenIDClaimsBuilder, OAuth2OpenIDTokenIssuer, OAuth2RefreshTokenGrant, OAuth2RefreshTokenIssuer, OAuth2ScopeAttributesResolver, OAuth2TokenRevoker, OAuth2TokenSigner, OAuth2TokenVerifier, PasswordGrantType, RobotCredentialsGrant, base64URLEncode, buildOAuth2BearerTokenResponse, buildOAuth2CodeChallenge, buildOAuth2TokenHash, generateOAuth2CodeVerifier };
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/core/oauth2/token/issuer/base.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE1G,8BAAsB,qBAAsB,YAAW,kBAAkB;IACrE,SAAS,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAI5C,SAAS,aAAa,OAAO,CAAC,EAAE,wBAAwB;IAMxD,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAIjH,QAAQ,CAAC,KAAK,GAAE,kBAAuB,GAAI,MAAM,GAAG,SAAS;IAY7D;;;;OAIG;IACH,QAAQ,CAAC,KAAK,GAAE,kBAAuB,GAAI,MAAM;CAYpD"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/core/oauth2/token/issuer/base.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAE1G,8BAAsB,qBAAsB,YAAW,kBAAkB;IACrE,SAAS,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAI5C,SAAS,aAAa,OAAO,CAAC,EAAE,wBAAwB;IAMxD,QAAQ,CAAC,KAAK,CAAC,KAAK,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAIjH,QAAQ,CAAC,KAAK,GAAE,kBAAuB,GAAI,MAAM,GAAG,SAAS;IAiB7D;;;;OAIG;IACH,QAAQ,CAAC,KAAK,GAAE,kBAAuB,GAAI,MAAM;CAYpD"}
@@ -6,8 +6,9 @@ var OAuth2BaseTokenIssuer = class {
6
6
  }
7
7
  buildIss(input = {}) {
8
8
  if (!this.options.issuer) return;
9
- if (input.realm_name) return `${this.options.issuer}/realms/${input.realm_name}`;
10
- return this.options.issuer;
9
+ const base = this.options.issuer.replace(/\/+$/, "");
10
+ if (input.realm_name) return `${base}/realms/${input.realm_name}`;
11
+ return base;
11
12
  }
12
13
  /**
13
14
  * Build utc expire time (in seconds).
@@ -1 +1 @@
1
- {"version":3,"file":"base.mjs","names":["OAuth2BaseTokenIssuer","options","buildIss","input","issuer","undefined","realm_name","buildExp","exp","utc","Math","floor","Date","getTime","maxAge"],"sources":["../../../../../src/core/oauth2/token/issuer/base.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenPayload } from '@authup/specs';\nimport type { IOAuth2TokenIssuer, OAuth2TokenIssuerOptions, OAuth2TokenIssuerResponse } from './types.ts';\n\nexport abstract class OAuth2BaseTokenIssuer implements IOAuth2TokenIssuer {\n protected options: OAuth2TokenIssuerOptions;\n\n // ------------------------------------------------------------------\n\n protected constructor(options?: OAuth2TokenIssuerOptions) {\n this.options = options || {};\n }\n\n // ------------------------------------------------------------------\n\n abstract issue(input: OAuth2TokenPayload, options?: OAuth2TokenIssuerOptions): Promise<OAuth2TokenIssuerResponse>;\n\n // ------------------------------------------------------------------\n\n buildIss(input: OAuth2TokenPayload = {}) : string | undefined {\n if (!this.options.issuer) {\n return undefined;\n }\n\n if (input.realm_name) {\n return `${this.options.issuer}/realms/${input.realm_name}`;\n }\n\n return this.options.issuer;\n }\n\n /**\n * Build utc expire time (in seconds).\n *\n * @param input\n */\n buildExp(input: OAuth2TokenPayload = {}) : number {\n if (input.exp) {\n return input.exp;\n }\n\n const utc = Math.floor(new Date().getTime() / 1000);\n if (this.options.maxAge) {\n return utc + this.options.maxAge;\n }\n\n return utc + 3_600;\n }\n}\n"],"mappings":";AAUA,IAAsBA,wBAAtB,MAAsBA;CACRC;CAIV,YAAsBA,SAAoC;AACtD,OAAKA,UAAUA,WAAW,EAAC;;CAS/BC,SAASC,QAA4B,EAAE,EAAuB;AAC1D,MAAI,CAAC,KAAKF,QAAQG,OACd;AAGJ,MAAID,MAAMG,WACN,QAAO,GAAG,KAAKL,QAAQG,OAAO,UAAUD,MAAMG;AAGlD,SAAO,KAAKL,QAAQG;;;;;;IAQxBG,SAASJ,QAA4B,EAAE,EAAW;AAC9C,MAAIA,MAAMK,IACN,QAAOL,MAAMK;EAGjB,MAAMC,MAAMC,KAAKC,uBAAM,IAAIC,MAAAA,EAAOC,SAAO,GAAK,IAAA;AAC9C,MAAI,KAAKZ,QAAQa,OACb,QAAOL,MAAM,KAAKR,QAAQa;AAG9B,SAAOL,MAAM"}
1
+ {"version":3,"file":"base.mjs","names":["OAuth2BaseTokenIssuer","options","buildIss","input","issuer","undefined","base","replace","realm_name","buildExp","exp","utc","Math","floor","Date","getTime","maxAge"],"sources":["../../../../../src/core/oauth2/token/issuer/base.ts"],"sourcesContent":["/*\n * Copyright (c) 2025.\n * Author Peter Placzek (tada5hi)\n * For the full copyright and license information,\n * view the LICENSE file that was distributed with this source code.\n */\n\nimport type { OAuth2TokenPayload } from '@authup/specs';\nimport type { IOAuth2TokenIssuer, OAuth2TokenIssuerOptions, OAuth2TokenIssuerResponse } from './types.ts';\n\nexport abstract class OAuth2BaseTokenIssuer implements IOAuth2TokenIssuer {\n protected options: OAuth2TokenIssuerOptions;\n\n // ------------------------------------------------------------------\n\n protected constructor(options?: OAuth2TokenIssuerOptions) {\n this.options = options || {};\n }\n\n // ------------------------------------------------------------------\n\n abstract issue(input: OAuth2TokenPayload, options?: OAuth2TokenIssuerOptions): Promise<OAuth2TokenIssuerResponse>;\n\n // ------------------------------------------------------------------\n\n buildIss(input: OAuth2TokenPayload = {}) : string | undefined {\n if (!this.options.issuer) {\n return undefined;\n }\n\n // Strip a trailing slash so a configured issuer like\n // `https://auth.example.com/` doesn't produce a malformed\n // `https://auth.example.com//realms/master`.\n const base = this.options.issuer.replace(/\\/+$/, '');\n\n if (input.realm_name) {\n return `${base}/realms/${input.realm_name}`;\n }\n\n return base;\n }\n\n /**\n * Build utc expire time (in seconds).\n *\n * @param input\n */\n buildExp(input: OAuth2TokenPayload = {}) : number {\n if (input.exp) {\n return input.exp;\n }\n\n const utc = Math.floor(new Date().getTime() / 1000);\n if (this.options.maxAge) {\n return utc + this.options.maxAge;\n }\n\n return utc + 3_600;\n }\n}\n"],"mappings":";AAUA,IAAsBA,wBAAtB,MAAsBA;CACRC;CAIV,YAAsBA,SAAoC;AACtD,OAAKA,UAAUA,WAAW,EAAC;;CAS/BC,SAASC,QAA4B,EAAE,EAAuB;AAC1D,MAAI,CAAC,KAAKF,QAAQG,OACd;EAMJ,MAAME,OAAO,KAAKL,QAAQG,OAAOG,QAAQ,QAAQ,GAAA;AAEjD,MAAIJ,MAAMK,WACN,QAAO,GAAGF,KAAK,UAAUH,MAAMK;AAGnC,SAAOF;;;;;;IAQXG,SAASN,QAA4B,EAAE,EAAW;AAC9C,MAAIA,MAAMO,IACN,QAAOP,MAAMO;EAGjB,MAAMC,MAAMC,KAAKC,uBAAM,IAAIC,MAAAA,EAAOC,SAAO,GAAK,IAAA;AAC9C,MAAI,KAAKd,QAAQe,OACb,QAAOL,MAAM,KAAKV,QAAQe;AAG9B,SAAOL,MAAM"}
package/dist/index.mjs CHANGED
@@ -107,6 +107,7 @@ import { setRequestScopes, useRequestScopes } from "./adapters/http/request/help
107
107
  import { setRequestToken, useRequestToken } from "./adapters/http/request/helpers/token.mjs";
108
108
  import { RequestPermissionEvaluator } from "./adapters/http/request/permission/module.mjs";
109
109
  import { HTTPOAuth2Authorizer } from "./adapters/http/adapters/oauth2/authorization/module.mjs";
110
+ import { extractClientCredentialsFromRequest } from "./adapters/http/adapters/oauth2/grant-types/utils/credentials.mjs";
110
111
  import { guessOauth2GrantTypeByRequest } from "./adapters/http/adapters/oauth2/grant-types/utils/guess.mjs";
111
112
  import { HTTPOAuth2AuthorizeGrant } from "./adapters/http/adapters/oauth2/grant-types/authorize.mjs";
112
113
  import { HTTPClientCredentialsGrant } from "./adapters/http/adapters/oauth2/grant-types/client-credentials.mjs";
@@ -205,4 +206,4 @@ import { defineCLIResetCommand } from "./cli/commands/reset.mjs";
205
206
  import { defineCLIStartCommand } from "./cli/commands/start.mjs";
206
207
  import "./cli/commands/index.mjs";
207
208
  import "reflect-metadata";
208
- export { ActivateController, Application, ApplicationBuilder, AuthenticationInjectionKey, AuthenticationModule, AuthorizationMiddleware, AuthorizeController, CacheInjectionKey, CacheModule, CachePrefix, ClientController, ClientEntity, ClientIdentityRepository, ClientPermissionController, ClientPermissionEntity, ClientPermissionRepositoryAdapter, ClientPermissionRequestValidator, ClientPermissionSubscriber, ClientRepositoryAdapter, ClientRoleController, ClientRoleEntity, ClientRoleRepositoryAdapter, ClientRoleRequestValidator, ClientRoleSubscriber, ClientScopeController, ClientScopeEntity, ClientScopeRepositoryAdapter, ClientScopeRequestValidator, ClientScopeSubscriber, ClientSubscriber, ComponentsModule, CompositeProvisioningSource, ConfigEnvironmentVariableName, ConfigInjectionKey, ConfigModule, DataSourceOptionsBuilder, DatabaseConflictError, DatabaseInjectionKey, DatabaseModule, DatabaseQueryResultCache, DefaultProvisioningSource, FileProvisioningSource, ForceLoggedInMiddleware, ForceUserLoggedInMiddleware, HTTPClientCredentialsGrant, HTTPInjectionKey, HTTPModule, HTTPOAuth2AuthorizeGrant, HTTPOAuth2Authorizer, HTTPOAuth2IdentityGrantType, HTTPOAuth2RefreshTokenGrant, HTTPPasswordGrant, HTTPRobotCredentialsGrant, IdentityInjectionKey, IdentityModule, IdentityProviderAccountEntity, IdentityProviderAccountRepository, IdentityProviderAccountSubscriber, IdentityProviderAttributeEntity, IdentityProviderAttributeMappingEntity, IdentityProviderAttributeMappingRepository, IdentityProviderAttributeSubscriber, IdentityProviderController, IdentityProviderEntity, IdentityProviderPermissionMappingEntity, IdentityProviderPermissionMappingRepository, IdentityProviderRepository, IdentityProviderRepositoryAdapter, IdentityProviderRoleMappingController, IdentityProviderRoleMappingEntity, IdentityProviderRoleMappingRepository, IdentityProviderRoleMappingRepositoryAdapter, IdentityProviderRoleSubscriber, IdentityProviderSubscriber, JwkController, KeyEntity, LDAPInjectionKey, LdapModule, LoggerInjectionKey, LoggerModule, MailInjectionKey, MailModule, ModuleName, OAuth2InjectionToken, OAuth2Module, OpenIDController, PasswordForgotController, PasswordResetController, PermissionController, PermissionDatabaseProvider, PermissionEntity, PermissionPolicyController, PermissionPolicyEntity, PermissionPolicyRepositoryAdapter, PermissionRepositoryAdapter, PermissionSubscriber, PolicyAttributeEntity, PolicyAttributeSubscriber, PolicyAttributesValidator, PolicyController, PolicyEntity, PolicyRepository, PolicyRepositoryAdapter, PolicySubscriber, PolicyValidator, ProvisionerModule, RealmController, RealmEntity, RealmRepository, RealmRepositoryAdapter, RealmSubscriber, RegisterController, RequestHandlerOperation, RequestIdentity, RequestPermissionEvaluator, RobotController, RobotEntity, RobotIdentityRepository, RobotPermissionController, RobotPermissionEntity, RobotPermissionRepositoryAdapter, RobotPermissionRequestValidator, RobotPermissionSubscriber, RobotRepositoryAdapter, RobotRoleController, RobotRoleEntity, RobotRoleRepositoryAdapter, RobotRoleRequestValidator, RobotRoleSubscriber, RobotSubscriber, RoleAttributeController, RoleAttributeEntity, RoleAttributeRepositoryAdapter, RoleAttributeRequestValidator, RoleAttributeSubscriber, RoleController, RoleEntity, RolePermissionController, RolePermissionEntity, RolePermissionRepositoryAdapter, RolePermissionRequestValidator, RolePermissionSubscriber, RoleRepository, RoleRepositoryAdapter, RoleSubscriber, RuntimeModule, ScopeController, ScopeEntity, ScopeRepositoryAdapter, ScopeSubscriber, SessionEntity, SessionRepository, StatusController, Swagger, SwaggerModule, TokenController, UserAttributeController, UserAttributeEntity, UserAttributeRepositoryAdapter, UserAttributeRequestValidator, UserAttributeSubscriber, UserController, UserEntity, UserIdentityRepository, UserPermissionController, UserPermissionEntity, UserPermissionRepositoryAdapter, UserPermissionRequestValidator, UserPermissionSubscriber, UserRepository, UserRepositoryAdapter, UserRoleController, UserRoleEntity, UserRoleRepositoryAdapter, UserRoleRequestValidator, UserRoleSubscriber, UserSubscriber, buildActorContext, createApplication, createAuthorizationMiddleware, createHttpServer, createLoggerMiddleware, createSwaggerMiddleware, defineCLIHealthCheckCommand, defineCLIMigrationCommand, defineCLIResetCommand, defineCLIStartCommand, defineCLISwaggerCommand, getJwkRouteHandler, getJwksRouteHandler, getRequestBodyRealmID, getRequestParamID, getRequestStringParam, getRequestStringParamOrFail, guessOauth2GrantTypeByRequest, isDatabaseTypeSupported, isDatabaseTypeSupportedForEnvironment, isRequestIdentityMasterRealmMember, registerAssetsMiddleware, registerBasicMiddleware, registerCorsMiddleware, registerErrorMiddleware, registerPrometheusMiddleware, registerRateLimitMiddleware, setDataSourceSync, setRequestIdentity, setRequestPermissionEvaluator, setRequestScopes, setRequestToken, unsetDataSourceSync, useDataSourceSync, useRequestIdentity, useRequestIdentityOrFail, useRequestParamID, useRequestPermissionEvaluator, useRequestScopes, useRequestToken };
209
+ export { ActivateController, Application, ApplicationBuilder, AuthenticationInjectionKey, AuthenticationModule, AuthorizationMiddleware, AuthorizeController, CacheInjectionKey, CacheModule, CachePrefix, ClientController, ClientEntity, ClientIdentityRepository, ClientPermissionController, ClientPermissionEntity, ClientPermissionRepositoryAdapter, ClientPermissionRequestValidator, ClientPermissionSubscriber, ClientRepositoryAdapter, ClientRoleController, ClientRoleEntity, ClientRoleRepositoryAdapter, ClientRoleRequestValidator, ClientRoleSubscriber, ClientScopeController, ClientScopeEntity, ClientScopeRepositoryAdapter, ClientScopeRequestValidator, ClientScopeSubscriber, ClientSubscriber, ComponentsModule, CompositeProvisioningSource, ConfigEnvironmentVariableName, ConfigInjectionKey, ConfigModule, DataSourceOptionsBuilder, DatabaseConflictError, DatabaseInjectionKey, DatabaseModule, DatabaseQueryResultCache, DefaultProvisioningSource, FileProvisioningSource, ForceLoggedInMiddleware, ForceUserLoggedInMiddleware, HTTPClientCredentialsGrant, HTTPInjectionKey, HTTPModule, HTTPOAuth2AuthorizeGrant, HTTPOAuth2Authorizer, HTTPOAuth2IdentityGrantType, HTTPOAuth2RefreshTokenGrant, HTTPPasswordGrant, HTTPRobotCredentialsGrant, IdentityInjectionKey, IdentityModule, IdentityProviderAccountEntity, IdentityProviderAccountRepository, IdentityProviderAccountSubscriber, IdentityProviderAttributeEntity, IdentityProviderAttributeMappingEntity, IdentityProviderAttributeMappingRepository, IdentityProviderAttributeSubscriber, IdentityProviderController, IdentityProviderEntity, IdentityProviderPermissionMappingEntity, IdentityProviderPermissionMappingRepository, IdentityProviderRepository, IdentityProviderRepositoryAdapter, IdentityProviderRoleMappingController, IdentityProviderRoleMappingEntity, IdentityProviderRoleMappingRepository, IdentityProviderRoleMappingRepositoryAdapter, IdentityProviderRoleSubscriber, IdentityProviderSubscriber, JwkController, KeyEntity, LDAPInjectionKey, LdapModule, LoggerInjectionKey, LoggerModule, MailInjectionKey, MailModule, ModuleName, OAuth2InjectionToken, OAuth2Module, OpenIDController, PasswordForgotController, PasswordResetController, PermissionController, PermissionDatabaseProvider, PermissionEntity, PermissionPolicyController, PermissionPolicyEntity, PermissionPolicyRepositoryAdapter, PermissionRepositoryAdapter, PermissionSubscriber, PolicyAttributeEntity, PolicyAttributeSubscriber, PolicyAttributesValidator, PolicyController, PolicyEntity, PolicyRepository, PolicyRepositoryAdapter, PolicySubscriber, PolicyValidator, ProvisionerModule, RealmController, RealmEntity, RealmRepository, RealmRepositoryAdapter, RealmSubscriber, RegisterController, RequestHandlerOperation, RequestIdentity, RequestPermissionEvaluator, RobotController, RobotEntity, RobotIdentityRepository, RobotPermissionController, RobotPermissionEntity, RobotPermissionRepositoryAdapter, RobotPermissionRequestValidator, RobotPermissionSubscriber, RobotRepositoryAdapter, RobotRoleController, RobotRoleEntity, RobotRoleRepositoryAdapter, RobotRoleRequestValidator, RobotRoleSubscriber, RobotSubscriber, RoleAttributeController, RoleAttributeEntity, RoleAttributeRepositoryAdapter, RoleAttributeRequestValidator, RoleAttributeSubscriber, RoleController, RoleEntity, RolePermissionController, RolePermissionEntity, RolePermissionRepositoryAdapter, RolePermissionRequestValidator, RolePermissionSubscriber, RoleRepository, RoleRepositoryAdapter, RoleSubscriber, RuntimeModule, ScopeController, ScopeEntity, ScopeRepositoryAdapter, ScopeSubscriber, SessionEntity, SessionRepository, StatusController, Swagger, SwaggerModule, TokenController, UserAttributeController, UserAttributeEntity, UserAttributeRepositoryAdapter, UserAttributeRequestValidator, UserAttributeSubscriber, UserController, UserEntity, UserIdentityRepository, UserPermissionController, UserPermissionEntity, UserPermissionRepositoryAdapter, UserPermissionRequestValidator, UserPermissionSubscriber, UserRepository, UserRepositoryAdapter, UserRoleController, UserRoleEntity, UserRoleRepositoryAdapter, UserRoleRequestValidator, UserRoleSubscriber, UserSubscriber, buildActorContext, createApplication, createAuthorizationMiddleware, createHttpServer, createLoggerMiddleware, createSwaggerMiddleware, defineCLIHealthCheckCommand, defineCLIMigrationCommand, defineCLIResetCommand, defineCLIStartCommand, defineCLISwaggerCommand, extractClientCredentialsFromRequest, getJwkRouteHandler, getJwksRouteHandler, getRequestBodyRealmID, getRequestParamID, getRequestStringParam, getRequestStringParamOrFail, guessOauth2GrantTypeByRequest, isDatabaseTypeSupported, isDatabaseTypeSupportedForEnvironment, isRequestIdentityMasterRealmMember, registerAssetsMiddleware, registerBasicMiddleware, registerCorsMiddleware, registerErrorMiddleware, registerPrometheusMiddleware, registerRateLimitMiddleware, setDataSourceSync, setRequestIdentity, setRequestPermissionEvaluator, setRequestScopes, setRequestToken, unsetDataSourceSync, useDataSourceSync, useRequestIdentity, useRequestIdentityOrFail, useRequestParamID, useRequestPermissionEvaluator, useRequestScopes, useRequestToken };