@nocobase/plugin-idp-oauth 2.1.0-alpha.10

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 (451) hide show
  1. package/LICENSE.txt +107 -0
  2. package/README.md +14 -0
  3. package/build.config.ts +46 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/ErrorPage.d.ts +11 -0
  7. package/dist/client/InteractionPage.d.ts +11 -0
  8. package/dist/client/index.d.ts +9 -0
  9. package/dist/client/index.js +10 -0
  10. package/dist/client/locale.d.ts +10 -0
  11. package/dist/client/models/index.d.ts +11 -0
  12. package/dist/client/plugin.d.ts +13 -0
  13. package/dist/externalVersion.js +18 -0
  14. package/dist/index.d.ts +10 -0
  15. package/dist/index.js +48 -0
  16. package/dist/locale/en-US.json +1 -0
  17. package/dist/locale/zh-CN.json +1 -0
  18. package/dist/node_modules/eta/LICENSE +7 -0
  19. package/dist/node_modules/eta/README.md +185 -0
  20. package/dist/node_modules/eta/dist/core.d.ts +179 -0
  21. package/dist/node_modules/eta/dist/core.d.ts.map +1 -0
  22. package/dist/node_modules/eta/dist/core.js +42 -0
  23. package/dist/node_modules/eta/dist/core.js.map +1 -0
  24. package/dist/node_modules/eta/dist/index.cjs +542 -0
  25. package/dist/node_modules/eta/dist/index.cjs.map +1 -0
  26. package/dist/node_modules/eta/dist/index.d.cts +187 -0
  27. package/dist/node_modules/eta/dist/index.d.cts.map +1 -0
  28. package/dist/node_modules/eta/dist/index.d.mts +187 -0
  29. package/dist/node_modules/eta/dist/index.d.mts.map +1 -0
  30. package/dist/node_modules/eta/dist/index.mjs +512 -0
  31. package/dist/node_modules/eta/dist/index.mjs.map +1 -0
  32. package/dist/node_modules/eta/package.json +75 -0
  33. package/dist/node_modules/jose/LICENSE.md +21 -0
  34. package/dist/node_modules/jose/README.md +153 -0
  35. package/dist/node_modules/jose/dist/types/index.d.ts +55 -0
  36. package/dist/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +31 -0
  37. package/dist/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +65 -0
  38. package/dist/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +31 -0
  39. package/dist/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +83 -0
  40. package/dist/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +38 -0
  41. package/dist/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
  42. package/dist/node_modules/jose/dist/types/jwk/embedded.d.ts +17 -0
  43. package/dist/node_modules/jose/dist/types/jwk/thumbprint.d.ts +32 -0
  44. package/dist/node_modules/jose/dist/types/jwks/local.d.ts +29 -0
  45. package/dist/node_modules/jose/dist/types/jwks/remote.d.ts +237 -0
  46. package/dist/node_modules/jose/dist/types/jws/compact/sign.d.ts +36 -0
  47. package/dist/node_modules/jose/dist/types/jws/compact/verify.d.ts +33 -0
  48. package/dist/node_modules/jose/dist/types/jws/flattened/sign.d.ts +42 -0
  49. package/dist/node_modules/jose/dist/types/jws/flattened/verify.d.ts +33 -0
  50. package/dist/node_modules/jose/dist/types/jws/general/sign.d.ts +53 -0
  51. package/dist/node_modules/jose/dist/types/jws/general/verify.d.ts +41 -0
  52. package/dist/node_modules/jose/dist/types/jwt/decrypt.d.ts +35 -0
  53. package/dist/node_modules/jose/dist/types/jwt/encrypt.d.ts +91 -0
  54. package/dist/node_modules/jose/dist/types/jwt/sign.d.ts +43 -0
  55. package/dist/node_modules/jose/dist/types/jwt/unsecured.d.ts +43 -0
  56. package/dist/node_modules/jose/dist/types/jwt/verify.d.ts +37 -0
  57. package/dist/node_modules/jose/dist/types/key/export.d.ts +33 -0
  58. package/dist/node_modules/jose/dist/types/key/generate_key_pair.d.ts +47 -0
  59. package/dist/node_modules/jose/dist/types/key/generate_secret.d.ts +35 -0
  60. package/dist/node_modules/jose/dist/types/key/import.d.ts +83 -0
  61. package/dist/node_modules/jose/dist/types/types.d.ts +852 -0
  62. package/dist/node_modules/jose/dist/types/util/base64url.d.ts +9 -0
  63. package/dist/node_modules/jose/dist/types/util/decode_jwt.d.ts +18 -0
  64. package/dist/node_modules/jose/dist/types/util/decode_protected_header.d.ts +17 -0
  65. package/dist/node_modules/jose/dist/types/util/errors.d.ts +213 -0
  66. package/dist/node_modules/jose/dist/webapi/index.js +32 -0
  67. package/dist/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
  68. package/dist/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
  69. package/dist/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +155 -0
  70. package/dist/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +165 -0
  71. package/dist/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
  72. package/dist/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
  73. package/dist/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
  74. package/dist/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
  75. package/dist/node_modules/jose/dist/webapi/jwks/local.js +119 -0
  76. package/dist/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
  77. package/dist/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
  78. package/dist/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
  79. package/dist/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
  80. package/dist/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
  81. package/dist/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
  82. package/dist/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
  83. package/dist/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
  84. package/dist/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
  85. package/dist/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
  86. package/dist/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
  87. package/dist/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
  88. package/dist/node_modules/jose/dist/webapi/key/export.js +11 -0
  89. package/dist/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
  90. package/dist/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
  91. package/dist/node_modules/jose/dist/webapi/key/import.js +57 -0
  92. package/dist/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
  93. package/dist/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
  94. package/dist/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
  95. package/dist/node_modules/jose/dist/webapi/lib/base64.js +22 -0
  96. package/dist/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
  97. package/dist/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
  98. package/dist/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
  99. package/dist/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
  100. package/dist/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
  101. package/dist/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
  102. package/dist/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
  103. package/dist/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
  104. package/dist/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
  105. package/dist/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
  106. package/dist/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
  107. package/dist/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
  108. package/dist/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
  109. package/dist/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
  110. package/dist/node_modules/jose/dist/webapi/lib/pbes2kw.js +39 -0
  111. package/dist/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
  112. package/dist/node_modules/jose/dist/webapi/lib/signing.js +68 -0
  113. package/dist/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
  114. package/dist/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
  115. package/dist/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
  116. package/dist/node_modules/jose/dist/webapi/util/base64url.js +30 -0
  117. package/dist/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
  118. package/dist/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
  119. package/dist/node_modules/jose/dist/webapi/util/errors.js +99 -0
  120. package/dist/node_modules/jose/package.json +200 -0
  121. package/dist/node_modules/light-my-request/.gitattributes +2 -0
  122. package/dist/node_modules/light-my-request/.github/dependabot.yml +13 -0
  123. package/dist/node_modules/light-my-request/.github/stale.yml +21 -0
  124. package/dist/node_modules/light-my-request/.github/workflows/benchmark.yml +30 -0
  125. package/dist/node_modules/light-my-request/.github/workflows/ci.yml +23 -0
  126. package/dist/node_modules/light-my-request/LICENSE +32 -0
  127. package/dist/node_modules/light-my-request/benchmark/benchmark.js +164 -0
  128. package/dist/node_modules/light-my-request/build/build-validation.js +100 -0
  129. package/dist/node_modules/light-my-request/eslint.config.js +9 -0
  130. package/dist/node_modules/light-my-request/index.js +2 -0
  131. package/dist/node_modules/light-my-request/lib/config-validator.js +919 -0
  132. package/dist/node_modules/light-my-request/lib/form-data.js +79 -0
  133. package/dist/node_modules/light-my-request/lib/parse-url.js +47 -0
  134. package/dist/node_modules/light-my-request/lib/request.js +290 -0
  135. package/dist/node_modules/light-my-request/lib/response.js +240 -0
  136. package/dist/node_modules/light-my-request/node_modules/process-warning/.gitattributes +2 -0
  137. package/dist/node_modules/light-my-request/node_modules/process-warning/.github/dependabot.yml +13 -0
  138. package/dist/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml +24 -0
  139. package/dist/node_modules/light-my-request/node_modules/process-warning/.taprc +2 -0
  140. package/dist/node_modules/light-my-request/node_modules/process-warning/benchmarks/warn.js +25 -0
  141. package/dist/node_modules/light-my-request/node_modules/process-warning/eslint.config.js +6 -0
  142. package/dist/node_modules/light-my-request/node_modules/process-warning/examples/example.js +11 -0
  143. package/dist/node_modules/light-my-request/node_modules/process-warning/index.js +124 -0
  144. package/dist/node_modules/light-my-request/node_modules/process-warning/package.json +73 -0
  145. package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-interpolated-string.test.js +29 -0
  146. package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-once-only.test.js +28 -0
  147. package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-reset.test.js +36 -0
  148. package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-set.test.js +30 -0
  149. package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-unlimited.test.js +37 -0
  150. package/dist/node_modules/light-my-request/node_modules/process-warning/test/index.test.js +99 -0
  151. package/dist/node_modules/light-my-request/node_modules/process-warning/test/issue-88.test.js +33 -0
  152. package/dist/node_modules/light-my-request/node_modules/process-warning/test/jest.test.js +22 -0
  153. package/dist/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js +80 -0
  154. package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts +37 -0
  155. package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.test-d.ts +36 -0
  156. package/dist/node_modules/light-my-request/package.json +1 -0
  157. package/dist/node_modules/light-my-request/test/async-await.test.js +55 -0
  158. package/dist/node_modules/light-my-request/test/index.test.js +2316 -0
  159. package/dist/node_modules/light-my-request/test/request.test.js +16 -0
  160. package/dist/node_modules/light-my-request/test/response.test.js +19 -0
  161. package/dist/node_modules/light-my-request/test/stream.test.js +359 -0
  162. package/dist/node_modules/light-my-request/types/index.d.ts +128 -0
  163. package/dist/node_modules/light-my-request/types/index.test-d.ts +149 -0
  164. package/dist/node_modules/oidc-provider/LICENSE.md +21 -0
  165. package/dist/node_modules/oidc-provider/README.md +174 -0
  166. package/dist/node_modules/oidc-provider/lib/actions/authorization/assign_claims.js +28 -0
  167. package/dist/node_modules/oidc-provider/lib/actions/authorization/assign_defaults.js +17 -0
  168. package/dist/node_modules/oidc-provider/lib/actions/authorization/authenticated_client_id.js +6 -0
  169. package/dist/node_modules/oidc-provider/lib/actions/authorization/backchannel_request_remap_errors.js +17 -0
  170. package/dist/node_modules/oidc-provider/lib/actions/authorization/backchannel_request_response.js +41 -0
  171. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_ciba_context.js +12 -0
  172. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_claims.js +68 -0
  173. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_client.js +21 -0
  174. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_client_grant_type.js +21 -0
  175. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_dpop_jkt.js +35 -0
  176. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_extra_params.js +18 -0
  177. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_id_token_hint.js +23 -0
  178. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_max_age.js +25 -0
  179. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_openid_scope.js +47 -0
  180. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_pkce.js +41 -0
  181. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_prompt.js +25 -0
  182. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_redirect_uri.js +41 -0
  183. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_requested_expiry.js +16 -0
  184. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_response_mode.js +54 -0
  185. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_response_type.js +26 -0
  186. package/dist/node_modules/oidc-provider/lib/actions/authorization/check_scope.js +53 -0
  187. package/dist/node_modules/oidc-provider/lib/actions/authorization/ciba_load_account.js +58 -0
  188. package/dist/node_modules/oidc-provider/lib/actions/authorization/ciba_required.js +13 -0
  189. package/dist/node_modules/oidc-provider/lib/actions/authorization/device_authorization_response.js +31 -0
  190. package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow.js +31 -0
  191. package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow_errors.js +37 -0
  192. package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow_response.js +55 -0
  193. package/dist/node_modules/oidc-provider/lib/actions/authorization/index.js +200 -0
  194. package/dist/node_modules/oidc-provider/lib/actions/authorization/interaction_emit.js +9 -0
  195. package/dist/node_modules/oidc-provider/lib/actions/authorization/interactions.js +149 -0
  196. package/dist/node_modules/oidc-provider/lib/actions/authorization/load_account.js +15 -0
  197. package/dist/node_modules/oidc-provider/lib/actions/authorization/load_grant.js +29 -0
  198. package/dist/node_modules/oidc-provider/lib/actions/authorization/load_pushed_authorization_request.js +36 -0
  199. package/dist/node_modules/oidc-provider/lib/actions/authorization/oauth_required.js +11 -0
  200. package/dist/node_modules/oidc-provider/lib/actions/authorization/oidc_required.js +27 -0
  201. package/dist/node_modules/oidc-provider/lib/actions/authorization/one_redirect_uri_clients.js +20 -0
  202. package/dist/node_modules/oidc-provider/lib/actions/authorization/process_request_object.js +214 -0
  203. package/dist/node_modules/oidc-provider/lib/actions/authorization/pushed_authorization_request_remap_errors.js +17 -0
  204. package/dist/node_modules/oidc-provider/lib/actions/authorization/pushed_authorization_request_response.js +65 -0
  205. package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_registration.js +12 -0
  206. package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_request_and_uri.js +12 -0
  207. package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_unsupported.js +33 -0
  208. package/dist/node_modules/oidc-provider/lib/actions/authorization/respond.js +46 -0
  209. package/dist/node_modules/oidc-provider/lib/actions/authorization/resume.js +111 -0
  210. package/dist/node_modules/oidc-provider/lib/actions/authorization/strip_outside_jar_params.js +19 -0
  211. package/dist/node_modules/oidc-provider/lib/actions/authorization/unsupported_rar.js +9 -0
  212. package/dist/node_modules/oidc-provider/lib/actions/challenge.js +22 -0
  213. package/dist/node_modules/oidc-provider/lib/actions/code_verification.js +122 -0
  214. package/dist/node_modules/oidc-provider/lib/actions/discovery.js +151 -0
  215. package/dist/node_modules/oidc-provider/lib/actions/end_session.js +222 -0
  216. package/dist/node_modules/oidc-provider/lib/actions/grants/authorization_code.js +144 -0
  217. package/dist/node_modules/oidc-provider/lib/actions/grants/ciba.js +127 -0
  218. package/dist/node_modules/oidc-provider/lib/actions/grants/client_credentials.js +79 -0
  219. package/dist/node_modules/oidc-provider/lib/actions/grants/device_code.js +125 -0
  220. package/dist/node_modules/oidc-provider/lib/actions/grants/index.js +7 -0
  221. package/dist/node_modules/oidc-provider/lib/actions/grants/refresh_token.js +229 -0
  222. package/dist/node_modules/oidc-provider/lib/actions/index.js +25 -0
  223. package/dist/node_modules/oidc-provider/lib/actions/interaction.js +150 -0
  224. package/dist/node_modules/oidc-provider/lib/actions/introspection.js +164 -0
  225. package/dist/node_modules/oidc-provider/lib/actions/jwks.js +7 -0
  226. package/dist/node_modules/oidc-provider/lib/actions/registration.js +274 -0
  227. package/dist/node_modules/oidc-provider/lib/actions/revocation.js +81 -0
  228. package/dist/node_modules/oidc-provider/lib/actions/token.js +74 -0
  229. package/dist/node_modules/oidc-provider/lib/actions/userinfo.js +183 -0
  230. package/dist/node_modules/oidc-provider/lib/adapters/memory_adapter.js +95 -0
  231. package/dist/node_modules/oidc-provider/lib/consts/client_attributes.js +211 -0
  232. package/dist/node_modules/oidc-provider/lib/consts/dev_keystore.js +18 -0
  233. package/dist/node_modules/oidc-provider/lib/consts/index.js +13 -0
  234. package/dist/node_modules/oidc-provider/lib/consts/jwa.js +47 -0
  235. package/dist/node_modules/oidc-provider/lib/consts/non_rejectable_claims.js +1 -0
  236. package/dist/node_modules/oidc-provider/lib/consts/param_list.js +23 -0
  237. package/dist/node_modules/oidc-provider/lib/helpers/_/camel_case.js +1 -0
  238. package/dist/node_modules/oidc-provider/lib/helpers/_/defaults.js +28 -0
  239. package/dist/node_modules/oidc-provider/lib/helpers/_/difference.js +1 -0
  240. package/dist/node_modules/oidc-provider/lib/helpers/_/is_plain_object.js +1 -0
  241. package/dist/node_modules/oidc-provider/lib/helpers/_/map_keys.js +9 -0
  242. package/dist/node_modules/oidc-provider/lib/helpers/_/merge.js +25 -0
  243. package/dist/node_modules/oidc-provider/lib/helpers/_/omit_by.js +11 -0
  244. package/dist/node_modules/oidc-provider/lib/helpers/_/pick.js +10 -0
  245. package/dist/node_modules/oidc-provider/lib/helpers/_/pick_by.js +10 -0
  246. package/dist/node_modules/oidc-provider/lib/helpers/_/remove.js +9 -0
  247. package/dist/node_modules/oidc-provider/lib/helpers/_/set.js +18 -0
  248. package/dist/node_modules/oidc-provider/lib/helpers/_/snake_case.js +1 -0
  249. package/dist/node_modules/oidc-provider/lib/helpers/_/upper_first.js +1 -0
  250. package/dist/node_modules/oidc-provider/lib/helpers/account_claims.js +6 -0
  251. package/dist/node_modules/oidc-provider/lib/helpers/add_client.js +14 -0
  252. package/dist/node_modules/oidc-provider/lib/helpers/als.js +3 -0
  253. package/dist/node_modules/oidc-provider/lib/helpers/append_www_authenticate.js +9 -0
  254. package/dist/node_modules/oidc-provider/lib/helpers/attention.js +23 -0
  255. package/dist/node_modules/oidc-provider/lib/helpers/base64url.js +11 -0
  256. package/dist/node_modules/oidc-provider/lib/helpers/certificate_thumbprint.js +15 -0
  257. package/dist/node_modules/oidc-provider/lib/helpers/challenge.js +111 -0
  258. package/dist/node_modules/oidc-provider/lib/helpers/check_attest_binding.js +10 -0
  259. package/dist/node_modules/oidc-provider/lib/helpers/claims.js +79 -0
  260. package/dist/node_modules/oidc-provider/lib/helpers/client_id_metadata_document.js +198 -0
  261. package/dist/node_modules/oidc-provider/lib/helpers/client_schema.js +700 -0
  262. package/dist/node_modules/oidc-provider/lib/helpers/combined_scope.js +17 -0
  263. package/dist/node_modules/oidc-provider/lib/helpers/configuration.js +544 -0
  264. package/dist/node_modules/oidc-provider/lib/helpers/constant_equals.js +20 -0
  265. package/dist/node_modules/oidc-provider/lib/helpers/defaults.js +3510 -0
  266. package/dist/node_modules/oidc-provider/lib/helpers/epoch_time.js +1 -0
  267. package/dist/node_modules/oidc-provider/lib/helpers/err_out.js +17 -0
  268. package/dist/node_modules/oidc-provider/lib/helpers/errors.js +161 -0
  269. package/dist/node_modules/oidc-provider/lib/helpers/features.js +51 -0
  270. package/dist/node_modules/oidc-provider/lib/helpers/fetch_body_check.js +25 -0
  271. package/dist/node_modules/oidc-provider/lib/helpers/fetch_request.js +221 -0
  272. package/dist/node_modules/oidc-provider/lib/helpers/filter_claims.js +16 -0
  273. package/dist/node_modules/oidc-provider/lib/helpers/formatters.js +24 -0
  274. package/dist/node_modules/oidc-provider/lib/helpers/grant_common.js +214 -0
  275. package/dist/node_modules/oidc-provider/lib/helpers/html_safe.js +19 -0
  276. package/dist/node_modules/oidc-provider/lib/helpers/initialize_adapter.js +24 -0
  277. package/dist/node_modules/oidc-provider/lib/helpers/initialize_app.js +243 -0
  278. package/dist/node_modules/oidc-provider/lib/helpers/initialize_clients.js +24 -0
  279. package/dist/node_modules/oidc-provider/lib/helpers/initialize_keystore.js +310 -0
  280. package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/check.js +21 -0
  281. package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/index.js +43 -0
  282. package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompt.js +95 -0
  283. package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompts/consent.js +105 -0
  284. package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompts/login.js +162 -0
  285. package/dist/node_modules/oidc-provider/lib/helpers/jwt.js +211 -0
  286. package/dist/node_modules/oidc-provider/lib/helpers/keystore.js +301 -0
  287. package/dist/node_modules/oidc-provider/lib/helpers/nanoid.js +5 -0
  288. package/dist/node_modules/oidc-provider/lib/helpers/oidc_context.js +284 -0
  289. package/dist/node_modules/oidc-provider/lib/helpers/params.js +27 -0
  290. package/dist/node_modules/oidc-provider/lib/helpers/pkce.js +30 -0
  291. package/dist/node_modules/oidc-provider/lib/helpers/pkce_format.js +17 -0
  292. package/dist/node_modules/oidc-provider/lib/helpers/process_response_types.js +202 -0
  293. package/dist/node_modules/oidc-provider/lib/helpers/re_render_errors.js +39 -0
  294. package/dist/node_modules/oidc-provider/lib/helpers/redirect_uri.js +16 -0
  295. package/dist/node_modules/oidc-provider/lib/helpers/resolve_resource.js +33 -0
  296. package/dist/node_modules/oidc-provider/lib/helpers/resolve_response_mode.js +7 -0
  297. package/dist/node_modules/oidc-provider/lib/helpers/resource_server.js +20 -0
  298. package/dist/node_modules/oidc-provider/lib/helpers/revoke.js +27 -0
  299. package/dist/node_modules/oidc-provider/lib/helpers/script_src_sha.js +21 -0
  300. package/dist/node_modules/oidc-provider/lib/helpers/sector_identifier.js +19 -0
  301. package/dist/node_modules/oidc-provider/lib/helpers/sector_validate.js +55 -0
  302. package/dist/node_modules/oidc-provider/lib/helpers/set_rt_bindings.js +21 -0
  303. package/dist/node_modules/oidc-provider/lib/helpers/token_find.js +51 -0
  304. package/dist/node_modules/oidc-provider/lib/helpers/type_validators.js +8 -0
  305. package/dist/node_modules/oidc-provider/lib/helpers/user_code_form.js +19 -0
  306. package/dist/node_modules/oidc-provider/lib/helpers/user_codes.js +38 -0
  307. package/dist/node_modules/oidc-provider/lib/helpers/valid_url.js +8 -0
  308. package/dist/node_modules/oidc-provider/lib/helpers/validate_dpop.js +129 -0
  309. package/dist/node_modules/oidc-provider/lib/helpers/validate_presence.js +17 -0
  310. package/dist/node_modules/oidc-provider/lib/helpers/weak_cache.js +11 -0
  311. package/dist/node_modules/oidc-provider/lib/index.js +21 -0
  312. package/dist/node_modules/oidc-provider/lib/models/access_token.js +31 -0
  313. package/dist/node_modules/oidc-provider/lib/models/authorization_code.js +27 -0
  314. package/dist/node_modules/oidc-provider/lib/models/backchannel_authentication_request.js +26 -0
  315. package/dist/node_modules/oidc-provider/lib/models/base_model.js +141 -0
  316. package/dist/node_modules/oidc-provider/lib/models/base_token.js +86 -0
  317. package/dist/node_modules/oidc-provider/lib/models/client.js +593 -0
  318. package/dist/node_modules/oidc-provider/lib/models/client_credentials.js +19 -0
  319. package/dist/node_modules/oidc-provider/lib/models/device_code.js +44 -0
  320. package/dist/node_modules/oidc-provider/lib/models/formats/dynamic.js +21 -0
  321. package/dist/node_modules/oidc-provider/lib/models/formats/index.js +14 -0
  322. package/dist/node_modules/oidc-provider/lib/models/formats/jwt.js +198 -0
  323. package/dist/node_modules/oidc-provider/lib/models/formats/opaque.js +58 -0
  324. package/dist/node_modules/oidc-provider/lib/models/grant.js +243 -0
  325. package/dist/node_modules/oidc-provider/lib/models/id_token.js +271 -0
  326. package/dist/node_modules/oidc-provider/lib/models/index.js +37 -0
  327. package/dist/node_modules/oidc-provider/lib/models/initial_access_token.js +12 -0
  328. package/dist/node_modules/oidc-provider/lib/models/interaction.js +73 -0
  329. package/dist/node_modules/oidc-provider/lib/models/mixins/apply.js +4 -0
  330. package/dist/node_modules/oidc-provider/lib/models/mixins/consumable.js +17 -0
  331. package/dist/node_modules/oidc-provider/lib/models/mixins/has_format.js +46 -0
  332. package/dist/node_modules/oidc-provider/lib/models/mixins/has_grant_id.js +12 -0
  333. package/dist/node_modules/oidc-provider/lib/models/mixins/has_grant_type.js +8 -0
  334. package/dist/node_modules/oidc-provider/lib/models/mixins/has_policies.js +38 -0
  335. package/dist/node_modules/oidc-provider/lib/models/mixins/is_attestation_constrained.js +15 -0
  336. package/dist/node_modules/oidc-provider/lib/models/mixins/is_sender_constrained.js +50 -0
  337. package/dist/node_modules/oidc-provider/lib/models/mixins/is_session_bound.js +38 -0
  338. package/dist/node_modules/oidc-provider/lib/models/mixins/set_audience.js +21 -0
  339. package/dist/node_modules/oidc-provider/lib/models/mixins/stores_auth.js +16 -0
  340. package/dist/node_modules/oidc-provider/lib/models/mixins/stores_pkce.js +9 -0
  341. package/dist/node_modules/oidc-provider/lib/models/pushed_authorization_request.js +21 -0
  342. package/dist/node_modules/oidc-provider/lib/models/refresh_token.js +47 -0
  343. package/dist/node_modules/oidc-provider/lib/models/registration_access_token.js +8 -0
  344. package/dist/node_modules/oidc-provider/lib/models/replay_detection.js +31 -0
  345. package/dist/node_modules/oidc-provider/lib/models/session.js +192 -0
  346. package/dist/node_modules/oidc-provider/lib/provider.js +453 -0
  347. package/dist/node_modules/oidc-provider/lib/response_modes/form_post.js +36 -0
  348. package/dist/node_modules/oidc-provider/lib/response_modes/fragment.js +7 -0
  349. package/dist/node_modules/oidc-provider/lib/response_modes/index.js +15 -0
  350. package/dist/node_modules/oidc-provider/lib/response_modes/jwt.js +43 -0
  351. package/dist/node_modules/oidc-provider/lib/response_modes/query.js +7 -0
  352. package/dist/node_modules/oidc-provider/lib/response_modes/web_message.js +55 -0
  353. package/dist/node_modules/oidc-provider/lib/shared/assemble_params.js +7 -0
  354. package/dist/node_modules/oidc-provider/lib/shared/attest_client_auth.js +111 -0
  355. package/dist/node_modules/oidc-provider/lib/shared/authorization_error_handler.js +104 -0
  356. package/dist/node_modules/oidc-provider/lib/shared/check_rar.js +75 -0
  357. package/dist/node_modules/oidc-provider/lib/shared/check_resource.js +77 -0
  358. package/dist/node_modules/oidc-provider/lib/shared/client_auth.js +263 -0
  359. package/dist/node_modules/oidc-provider/lib/shared/conditional_body.js +9 -0
  360. package/dist/node_modules/oidc-provider/lib/shared/cors.js +49 -0
  361. package/dist/node_modules/oidc-provider/lib/shared/error_handler.js +59 -0
  362. package/dist/node_modules/oidc-provider/lib/shared/jwt_client_auth.js +79 -0
  363. package/dist/node_modules/oidc-provider/lib/shared/no_cache.js +4 -0
  364. package/dist/node_modules/oidc-provider/lib/shared/reject_dupes.js +45 -0
  365. package/dist/node_modules/oidc-provider/lib/shared/reject_structured_tokens.js +18 -0
  366. package/dist/node_modules/oidc-provider/lib/shared/selective_body.js +60 -0
  367. package/dist/node_modules/oidc-provider/lib/shared/session.js +68 -0
  368. package/dist/node_modules/oidc-provider/lib/shared/set_www_authenticate_header.js +52 -0
  369. package/dist/node_modules/oidc-provider/lib/views/index.js +22 -0
  370. package/dist/node_modules/oidc-provider/lib/views/interaction.js +171 -0
  371. package/dist/node_modules/oidc-provider/lib/views/layout.js +237 -0
  372. package/dist/node_modules/oidc-provider/lib/views/login.js +43 -0
  373. package/dist/node_modules/oidc-provider/node_modules/@koa/router/LICENSE +21 -0
  374. package/dist/node_modules/oidc-provider/node_modules/@koa/router/README.md +1370 -0
  375. package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.d.mts +1003 -0
  376. package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.d.ts +1003 -0
  377. package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.js +1616 -0
  378. package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.mjs +1573 -0
  379. package/dist/node_modules/oidc-provider/node_modules/@koa/router/package.json +122 -0
  380. package/dist/node_modules/oidc-provider/node_modules/debug/LICENSE +20 -0
  381. package/dist/node_modules/oidc-provider/node_modules/debug/README.md +481 -0
  382. package/dist/node_modules/oidc-provider/node_modules/debug/package.json +64 -0
  383. package/dist/node_modules/oidc-provider/node_modules/debug/src/browser.js +272 -0
  384. package/dist/node_modules/oidc-provider/node_modules/debug/src/common.js +292 -0
  385. package/dist/node_modules/oidc-provider/node_modules/debug/src/index.js +10 -0
  386. package/dist/node_modules/oidc-provider/node_modules/debug/src/node.js +263 -0
  387. package/dist/node_modules/oidc-provider/node_modules/http-errors/HISTORY.md +186 -0
  388. package/dist/node_modules/oidc-provider/node_modules/http-errors/LICENSE +23 -0
  389. package/dist/node_modules/oidc-provider/node_modules/http-errors/README.md +169 -0
  390. package/dist/node_modules/oidc-provider/node_modules/http-errors/index.js +290 -0
  391. package/dist/node_modules/oidc-provider/node_modules/http-errors/package.json +54 -0
  392. package/dist/node_modules/oidc-provider/node_modules/jsesc/LICENSE-MIT.txt +20 -0
  393. package/dist/node_modules/oidc-provider/node_modules/jsesc/README.md +422 -0
  394. package/dist/node_modules/oidc-provider/node_modules/jsesc/bin/jsesc +148 -0
  395. package/dist/node_modules/oidc-provider/node_modules/jsesc/jsesc.js +337 -0
  396. package/dist/node_modules/oidc-provider/node_modules/jsesc/man/jsesc.1 +94 -0
  397. package/dist/node_modules/oidc-provider/node_modules/jsesc/package.json +56 -0
  398. package/dist/node_modules/oidc-provider/node_modules/nanoid/LICENSE +20 -0
  399. package/dist/node_modules/oidc-provider/node_modules/nanoid/README.md +38 -0
  400. package/dist/node_modules/oidc-provider/node_modules/nanoid/bin/nanoid.js +55 -0
  401. package/dist/node_modules/oidc-provider/node_modules/nanoid/index.browser.js +29 -0
  402. package/dist/node_modules/oidc-provider/node_modules/nanoid/index.d.ts +106 -0
  403. package/dist/node_modules/oidc-provider/node_modules/nanoid/index.js +47 -0
  404. package/dist/node_modules/oidc-provider/node_modules/nanoid/nanoid.js +1 -0
  405. package/dist/node_modules/oidc-provider/node_modules/nanoid/non-secure/index.d.ts +48 -0
  406. package/dist/node_modules/oidc-provider/node_modules/nanoid/non-secure/index.js +21 -0
  407. package/dist/node_modules/oidc-provider/node_modules/nanoid/package.json +46 -0
  408. package/dist/node_modules/oidc-provider/node_modules/nanoid/url-alphabet/index.js +2 -0
  409. package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/LICENSE +21 -0
  410. package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/Readme.md +224 -0
  411. package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.d.ts +144 -0
  412. package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.js +409 -0
  413. package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.js.map +1 -0
  414. package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/package.json +64 -0
  415. package/dist/node_modules/oidc-provider/node_modules/statuses/HISTORY.md +87 -0
  416. package/dist/node_modules/oidc-provider/node_modules/statuses/LICENSE +23 -0
  417. package/dist/node_modules/oidc-provider/node_modules/statuses/README.md +139 -0
  418. package/dist/node_modules/oidc-provider/node_modules/statuses/codes.json +65 -0
  419. package/dist/node_modules/oidc-provider/node_modules/statuses/index.js +146 -0
  420. package/dist/node_modules/oidc-provider/node_modules/statuses/package.json +49 -0
  421. package/dist/node_modules/oidc-provider/package.json +95 -0
  422. package/dist/node_modules/quick-lru/index.d.ts +178 -0
  423. package/dist/node_modules/quick-lru/index.js +329 -0
  424. package/dist/node_modules/quick-lru/license +9 -0
  425. package/dist/node_modules/quick-lru/package.json +54 -0
  426. package/dist/node_modules/quick-lru/readme.md +236 -0
  427. package/dist/node_modules/statuses/HISTORY.md +65 -0
  428. package/dist/node_modules/statuses/LICENSE +23 -0
  429. package/dist/node_modules/statuses/README.md +127 -0
  430. package/dist/node_modules/statuses/codes.json +66 -0
  431. package/dist/node_modules/statuses/index.js +113 -0
  432. package/dist/node_modules/statuses/package.json +48 -0
  433. package/dist/server/cache-adapter.d.ts +33 -0
  434. package/dist/server/cache-adapter.js +159 -0
  435. package/dist/server/index.d.ts +10 -0
  436. package/dist/server/index.js +48 -0
  437. package/dist/server/interaction.d.ts +26 -0
  438. package/dist/server/interaction.js +172 -0
  439. package/dist/server/paths.d.ts +19 -0
  440. package/dist/server/paths.js +64 -0
  441. package/dist/server/plugin.d.ts +16 -0
  442. package/dist/server/plugin.js +108 -0
  443. package/dist/server/provider-dispatch.d.ts +32 -0
  444. package/dist/server/provider-dispatch.js +252 -0
  445. package/dist/server/service.d.ts +63 -0
  446. package/dist/server/service.js +540 -0
  447. package/dist/server/utils.d.ts +12 -0
  448. package/dist/server/utils.js +58 -0
  449. package/package.json +24 -0
  450. package/server.d.ts +2 -0
  451. package/server.js +1 -0
@@ -0,0 +1,3510 @@
1
+ /* eslint-disable no-shadow */
2
+ /* eslint-disable no-unused-vars */
3
+
4
+ import * as crypto from 'node:crypto';
5
+
6
+ import * as attention from './attention.js';
7
+ import nanoid from './nanoid.js';
8
+ import { base as defaultPolicy } from './interaction_policy/index.js';
9
+ import htmlSafe from './html_safe.js';
10
+ import * as errors from './errors.js';
11
+
12
+ const warned = new Set();
13
+ function shouldChange(name, msg) {
14
+ if (!warned.has(name)) {
15
+ warned.add(name);
16
+ attention.info(`default ${name} function called, you SHOULD change it in order to ${msg}.`);
17
+ }
18
+ }
19
+ function mustChange(name, msg) {
20
+ if (!warned.has(name)) {
21
+ warned.add(name);
22
+ attention.warn(`default ${name} function called, you MUST change it in order to ${msg}.`);
23
+ }
24
+ }
25
+
26
+ function clientBasedCORS(ctx, origin, client) {
27
+ shouldChange('clientBasedCORS', 'control allowed CORS Origins based on the client making a CORS request');
28
+ if (ctx.oidc.route === 'userinfo' || client.clientAuthMethod === 'none') {
29
+ return client.redirectUris.some((uri) => URL.parse(uri)?.origin === origin);
30
+ }
31
+ return false;
32
+ }
33
+
34
+ function getCertificate(ctx) {
35
+ mustChange('features.mTLS.getCertificate', 'retrieve the PEM-formatted client certificate from the request context');
36
+ throw new Error('features.mTLS.getCertificate function not configured');
37
+ }
38
+
39
+ function certificateAuthorized(ctx) {
40
+ mustChange('features.mTLS.certificateAuthorized', 'determine if the client certificate is verified and comes from a trusted CA');
41
+ throw new Error('features.mTLS.certificateAuthorized function not configured');
42
+ }
43
+
44
+ function certificateSubjectMatches(ctx, property, expected) {
45
+ mustChange('features.mTLS.certificateSubjectMatches', 'verify that the tls_client_auth_* registered client property value matches the certificate one');
46
+ throw new Error('features.mTLS.certificateSubjectMatches function not configured');
47
+ }
48
+
49
+ function deviceInfo(ctx) {
50
+ return {
51
+ ip: ctx.ip,
52
+ ua: ctx.get('user-agent'),
53
+ };
54
+ }
55
+
56
+ async function userCodeInputSource(ctx, form, out, err) {
57
+ // @param ctx - koa request context
58
+ // @param form - form source (id="op.deviceInputForm") to be embedded in the page and submitted
59
+ // by the End-User.
60
+ // @param out - if an error is returned the out object contains details that are fit to be
61
+ // rendered, i.e. does not include internal error messages
62
+ // @param err - error object with an optional userCode property passed when the form is being
63
+ // re-rendered due to code missing/invalid/expired
64
+ shouldChange('features.deviceFlow.userCodeInputSource', 'customize the look of the user code input page');
65
+ let msg;
66
+ if (err && (err.userCode || err.name === 'NoCodeError')) {
67
+ msg = '<p class="red">The code you entered is incorrect. Try again</p>';
68
+ } else if (err && err.name === 'AbortedError') {
69
+ msg = '<p class="red">The Sign-in request was interrupted</p>';
70
+ } else if (err) {
71
+ msg = '<p class="red">There was an error processing your request</p>';
72
+ } else {
73
+ msg = '<p>Enter the code displayed on your device</p>';
74
+ }
75
+ ctx.body = `<!DOCTYPE html>
76
+ <html>
77
+ <head>
78
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
79
+ <meta charset="utf-8">
80
+ <title>Sign-in</title>
81
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
82
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
83
+ <style>
84
+ @import url(https://fonts.googleapis.com/css?family=Roboto:400,100);h1,h1+p{font-weight:100;text-align:center}body{font-family:Roboto,sans-serif;margin-top:25px;margin-bottom:25px}.container{padding:0 40px 10px;width:274px;background-color:#F7F7F7;margin:0 auto 10px;border-radius:2px;box-shadow:0 2px 2px rgba(0,0,0,.3);overflow:hidden}h1{font-size:2.3em}p.red{color:#d50000}input[type=email],input[type=password],input[type=text]{height:44px;font-size:16px;width:100%;margin-bottom:10px;-webkit-appearance:none;background:#fff;border:1px solid #d9d9d9;border-top:1px solid silver;padding:0 8px;box-sizing:border-box;-moz-box-sizing:border-box}[type=submit]{width:100%;display:block;margin-bottom:10px;position:relative;text-align:center;font-size:14px;font-family:Arial,sans-serif;font-weight:700;height:36px;padding:0 8px;border:0;color:#fff;text-shadow:0 1px rgba(0,0,0,.1);background-color:#4d90fe;cursor:pointer}[type=submit]:hover{border:0;text-shadow:0 1px rgba(0,0,0,.3);background-color:#357ae8}input[type=text]{text-transform:uppercase;text-align: center}input[type=text]::placeholder{text-transform: none}
85
+ </style>
86
+ </head>
87
+ <body>
88
+ <div class="container">
89
+ <h1>Sign-in</h1>
90
+ ${msg}
91
+ ${form}
92
+ <button type="submit" form="op.deviceInputForm">Continue</button>
93
+ </div>
94
+ </body>
95
+ </html>`;
96
+ }
97
+
98
+ function requireNonce(ctx) {
99
+ return false;
100
+ }
101
+
102
+ async function getAttestationSignaturePublicKey(ctx, iss, header, client) {
103
+ // @param ctx - koa request context
104
+ // @param iss - Issuer Identifier from the Client Attestation JWT
105
+ // @param header - Protected Header of the Client Attestation JWT
106
+ // @param client - client making the request
107
+ mustChange('features.attestClientAuth.getAttestationSignaturePublicKey', 'be able to verify the Client Attestation JWT signature');
108
+ throw new Error('features.attestClientAuth.getAttestationSignaturePublicKey not implemented');
109
+ }
110
+
111
+ async function assertAttestationJwtAndPop(ctx, attestation, pop, client) {
112
+ // @param ctx - koa request context
113
+ // @param attestation - verified and parsed Attestation JWT
114
+ // attestation.protectedHeader - parsed protected header object
115
+ // attestation.payload - parsed protected header object
116
+ // attestation.key - CryptoKey that verified the Attestation JWT signature
117
+ // @param pop - verified and parsed Attestation JWT PoP
118
+ // pop.protectedHeader - parsed protected header object
119
+ // pop.payload - parsed protected header object
120
+ // pop.key - CryptoKey that verified the Attestation JWT PoP signature
121
+ // @param client - client making the request
122
+ }
123
+
124
+ async function userCodeConfirmSource(ctx, form, client, deviceInfo, userCode) {
125
+ // @param ctx - koa request context
126
+ // @param form - form source (id="op.deviceConfirmForm") to be embedded in the page and
127
+ // submitted by the End-User.
128
+ // @param deviceInfo - device information from the device_authorization_endpoint call
129
+ // @param userCode - formatted user code by the configured mask
130
+ shouldChange('features.deviceFlow.userCodeConfirmSource', 'customize the look of the user code confirmation page');
131
+ ctx.body = `<!DOCTYPE html>
132
+ <html>
133
+ <head>
134
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
135
+ <meta charset="utf-8">
136
+ <title>Device Login Confirmation</title>
137
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
138
+ <style>
139
+ @import url(https://fonts.googleapis.com/css?family=Roboto:400,100);.help,h1,h1+p{text-align:center}h1,h1+p{font-weight:100}body{font-family:Roboto,sans-serif;margin-top:25px;margin-bottom:25px}.container{padding:0 40px 10px;width:274px;background-color:#f7f7f7;margin:0 auto 10px;border-radius:2px;box-shadow:0 2px 2px rgba(0,0,0,.3);overflow:hidden}h1{font-size:2.3em}button[autofocus]{width:100%;display:block;margin-bottom:10px;position:relative;font-size:14px;font-family:Arial,sans-serif;font-weight:700;height:36px;padding:0 8px;border:0;color:#fff;text-shadow:0 1px rgba(0,0,0,.1);background-color:#4d90fe;cursor:pointer}button[autofocus]:hover{border:0;text-shadow:0 1px rgba(0,0,0,.3);background-color:#357ae8}button[name=abort]{background:0 0!important;border:none;padding:0!important;font:inherit;cursor:pointer}a,button[name=abort]{text-decoration:none;color:#666;font-weight:400;display:inline-block;opacity:.6}.help{width:100%;font-size:12px}code{font-size:2em}
140
+ </style>
141
+ </head>
142
+ <body>
143
+ <div class="container">
144
+ <h1>Confirm Device</h1>
145
+ <p>
146
+ <strong>${ctx.oidc.client.clientName || ctx.oidc.client.clientId}</strong>
147
+ <br/><br/>
148
+ The following code should be displayed on your device<br/><br/>
149
+ <code>${userCode}</code>
150
+ <br/><br/>
151
+ <small>If you did not initiate this action, the code does not match or are unaware of such device in your possession please close this window or click abort.</small>
152
+ </p>
153
+ ${form}
154
+ <button autofocus type="submit" form="op.deviceConfirmForm">Continue</button>
155
+ <div class="help">
156
+ <button type="submit" form="op.deviceConfirmForm" value="yes" name="abort">[ Abort ]</button>
157
+ </div>
158
+ </div>
159
+ </body>
160
+ </html>`;
161
+ }
162
+
163
+ async function successSource(ctx) {
164
+ // @param ctx - koa request context
165
+ shouldChange('features.deviceFlow.successSource', 'customize the look of the device code success page');
166
+ ctx.body = `<!DOCTYPE html>
167
+ <html>
168
+ <head>
169
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
170
+ <meta charset="utf-8">
171
+ <title>Sign-in Success</title>
172
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
173
+ <style>
174
+ @import url(https://fonts.googleapis.com/css?family=Roboto:400,100);h1,h1+p{font-weight:100;text-align:center}body{font-family:Roboto,sans-serif;margin-top:25px;margin-bottom:25px}.container{padding:0 40px 10px;width:274px;background-color:#F7F7F7;margin:0 auto 10px;border-radius:2px;box-shadow:0 2px 2px rgba(0,0,0,.3);overflow:hidden}h1{font-size:2.3em}
175
+ </style>
176
+ </head>
177
+ <body>
178
+ <div class="container">
179
+ <h1>Sign-in Success</h1>
180
+ <p>Your sign-in ${ctx.oidc.client.clientName ? `with ${ctx.oidc.client.clientName}` : ''} was successful, you can now close this page.</p>
181
+ </div>
182
+ </body>
183
+ </html>`;
184
+ }
185
+
186
+ async function introspectionAllowedPolicy(ctx, client, token) {
187
+ // @param ctx - koa request context
188
+ // @param client - authenticated client making the request
189
+ // @param token - token being introspected
190
+ shouldChange('features.introspection.allowedPolicy', 'to check whether the caller is authorized to receive the introspection response');
191
+
192
+ if (
193
+ client.clientAuthMethod === 'none'
194
+ && token.clientId !== ctx.oidc.client.clientId
195
+ ) {
196
+ return false;
197
+ }
198
+
199
+ return true;
200
+ }
201
+
202
+ async function revocationAllowedPolicy(ctx, client, token) {
203
+ // @param ctx - koa request context
204
+ // @param client - authenticated client making the request
205
+ // @param token - token being revoked
206
+ shouldChange('features.revocation.allowedPolicy', 'to check whether the caller is authorized to revoke the token');
207
+
208
+ if (token.clientId !== client.clientId) {
209
+ if (client.clientAuthMethod === 'none') {
210
+ // do not revoke but respond as success to disallow guessing valid tokens
211
+ return false;
212
+ }
213
+
214
+ throw new errors.InvalidRequest('client is not authorized to revoke the presented token');
215
+ }
216
+
217
+ return true;
218
+ }
219
+
220
+ function idFactory(ctx) {
221
+ return nanoid();
222
+ }
223
+
224
+ async function secretFactory(ctx) {
225
+ return crypto.randomBytes(64).toString('base64url');
226
+ }
227
+
228
+ async function defaultResource(ctx, client, oneOf) {
229
+ // @param ctx - koa request context
230
+ // @param client - client making the request
231
+ // @param oneOf {string[]} - The authorization server needs to select **one** of the values provided.
232
+ // Default is that the array is provided so that the request will fail.
233
+ // This argument is only provided when called during
234
+ // Authorization Code / Refresh Token / Device Code exchanges.
235
+
236
+ if (oneOf) return oneOf;
237
+ return undefined;
238
+ }
239
+
240
+ async function useGrantedResource(ctx, model) {
241
+ // @param ctx - koa request context
242
+ // @param model - depending on the request's grant_type this can be either an AuthorizationCode, BackchannelAuthenticationRequest,
243
+ // RefreshToken, or DeviceCode model instance.
244
+ return false;
245
+ }
246
+
247
+ async function getResourceServerInfo(ctx, resourceIndicator, client) {
248
+ // @param ctx - koa request context
249
+ // @param resourceIndicator - resource indicator value either requested or resolved by the defaultResource helper.
250
+ // @param client - client making the request
251
+ mustChange('features.resourceIndicators.getResourceServerInfo', 'to provide details about the Resource Server identified by the Resource Indicator');
252
+ throw new errors.InvalidTarget();
253
+ }
254
+
255
+ async function extraTokenClaims(ctx, token) {
256
+ return undefined;
257
+ }
258
+
259
+ async function expiresWithSession(ctx, code) {
260
+ return !code.scopes.has('offline_access');
261
+ }
262
+
263
+ async function issueRefreshToken(ctx, client, code) {
264
+ return (
265
+ client.grantTypeAllowed('refresh_token')
266
+ && code.scopes.has('offline_access')
267
+ );
268
+ }
269
+
270
+ function pkceRequired(ctx, client) {
271
+ // All public clients MUST use PKCE as per
272
+ // https://www.rfc-editor.org/rfc/rfc9700.html#section-2.1.1-2.1
273
+ if (client.clientAuthMethod === 'none') {
274
+ return true;
275
+ }
276
+
277
+ const fapiProfile = ctx.oidc.isFapi('2.0', '1.0 Final');
278
+
279
+ // FAPI 2.0 as per
280
+ // https://openid.net/specs/fapi-security-profile-2_0-final.html#section-5.3.2.2-2.5
281
+ if (fapiProfile === '2.0') {
282
+ return true;
283
+ }
284
+
285
+ // FAPI 1.0 Advanced as per
286
+ // https://openid.net/specs/openid-financial-api-part-2-1_0-final.html#authorization-server
287
+ if (fapiProfile === '1.0 Final' && ctx.oidc.route === 'pushed_authorization_request') {
288
+ return true;
289
+ }
290
+
291
+ // In all other cases use of PKCE is RECOMMENDED as per
292
+ // https://www.rfc-editor.org/rfc/rfc9700.html#section-2.1.1-2.2
293
+ // but the server doesn't force them to.
294
+ return false;
295
+ }
296
+
297
+ async function pairwiseIdentifier(ctx, accountId, client) {
298
+ mustChange('pairwiseIdentifier', 'provide an implementation for pairwise identifiers');
299
+ throw new Error('pairwiseIdentifier not implemented');
300
+ }
301
+
302
+ function AccessTokenTTL(ctx, token, client) {
303
+ shouldChange('ttl.AccessToken', 'define the expiration for AccessToken artifacts');
304
+ return token.resourceServer?.accessTokenTTL || 60 * 60; // 1 hour in seconds
305
+ }
306
+
307
+ function AuthorizationCodeTTL(ctx, code, client) {
308
+ return 60; // 1 minute in seconds
309
+ }
310
+
311
+ function ClientCredentialsTTL(ctx, token, client) {
312
+ shouldChange('ttl.ClientCredentials', 'define the expiration for ClientCredentials artifacts');
313
+ return token.resourceServer?.accessTokenTTL || 10 * 60; // 10 minutes in seconds
314
+ }
315
+
316
+ function DeviceCodeTTL(ctx, deviceCode, client) {
317
+ shouldChange('ttl.DeviceCode', 'define the expiration for DeviceCode artifacts');
318
+ return 10 * 60; // 10 minutes in seconds
319
+ }
320
+
321
+ function BackchannelAuthenticationRequestTTL(ctx, request, client) {
322
+ shouldChange('ttl.BackchannelAuthenticationRequest', 'define the expiration for BackchannelAuthenticationRequest artifacts');
323
+ if (ctx?.oidc?.params.requested_expiry) {
324
+ return Math.min(10 * 60, +ctx.oidc.params.requested_expiry); // 10 minutes in seconds or requested_expiry, whichever is shorter
325
+ }
326
+
327
+ return 10 * 60; // 10 minutes in seconds
328
+ }
329
+
330
+ function IdTokenTTL(ctx, token, client) {
331
+ shouldChange('ttl.IdToken', 'define the expiration for IdToken artifacts');
332
+ return 60 * 60; // 1 hour in seconds
333
+ }
334
+
335
+ function RefreshTokenTTL(ctx, token, client) {
336
+ shouldChange('ttl.RefreshToken', 'define the expiration for RefreshToken artifacts');
337
+ if (
338
+ ctx?.oidc?.entities.RotatedRefreshToken
339
+ && client.applicationType === 'web'
340
+ && client.clientAuthMethod === 'none'
341
+ && !token.isSenderConstrained()
342
+ ) {
343
+ // Non-Sender Constrained SPA RefreshTokens do not have infinite expiration through rotation
344
+ return ctx.oidc.entities.RotatedRefreshToken.remainingTTL;
345
+ }
346
+
347
+ return 14 * 24 * 60 * 60; // 14 days in seconds
348
+ }
349
+
350
+ function InteractionTTL(ctx, interaction) {
351
+ shouldChange('ttl.Interaction', 'define the expiration for Interaction artifacts');
352
+ return 60 * 60; // 1 hour in seconds
353
+ }
354
+
355
+ function SessionTTL(ctx, session) {
356
+ shouldChange('ttl.Session', 'define the expiration for Session artifacts');
357
+ return 14 * 24 * 60 * 60; // 14 days in seconds
358
+ }
359
+
360
+ function GrantTTL(ctx, grant, client) {
361
+ shouldChange('ttl.Grant', 'define the expiration for Grant artifacts');
362
+ return 14 * 24 * 60 * 60; // 14 days in seconds
363
+ }
364
+
365
+ function extraClientMetadataValidator(ctx, key, value, metadata) {
366
+ // @param ctx - koa request context (only provided when a client is being constructed during
367
+ // Client Registration Request or Client Update Request
368
+ // @param key - the client metadata property name
369
+ // @param value - the property value
370
+ // @param metadata - the current accumulated client metadata
371
+ // @param ctx - koa request context (only provided when a client is being constructed during
372
+ // Client Registration Request or Client Update Request
373
+ }
374
+
375
+ async function postLogoutSuccessSource(ctx) {
376
+ // @param ctx - koa request context
377
+ shouldChange('features.rpInitiatedLogout.postLogoutSuccessSource', 'customize the look of the default post logout success page');
378
+ const display = ctx.oidc.client?.clientName || ctx.oidc.client?.clientId;
379
+ ctx.body = `<!DOCTYPE html>
380
+ <html>
381
+ <head>
382
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
383
+ <meta charset="utf-8">
384
+ <title>Sign-out Success</title>
385
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
386
+ <style>
387
+ @import url(https://fonts.googleapis.com/css?family=Roboto:400,100);h1,h1+p{font-weight:100;text-align:center}body{font-family:Roboto,sans-serif;margin-top:25px;margin-bottom:25px}.container{padding:0 40px 10px;width:274px;background-color:#F7F7F7;margin:0 auto 10px;border-radius:2px;box-shadow:0 2px 2px rgba(0,0,0,.3);overflow:hidden}h1{font-size:2.3em}
388
+ </style>
389
+ </head>
390
+ <body>
391
+ <div class="container">
392
+ <h1>Sign-out Success</h1>
393
+ <p>Your sign-out ${display ? `with ${display}` : ''} was successful.</p>
394
+ </div>
395
+ </body>
396
+ </html>`;
397
+ }
398
+
399
+ async function logoutSource(ctx, form) {
400
+ // @param ctx - koa request context
401
+ // @param form - form source (id="op.logoutForm") to be embedded in the page and submitted by
402
+ // the End-User
403
+ shouldChange('features.rpInitiatedLogout.logoutSource', 'customize the look of the logout page');
404
+ ctx.body = `<!DOCTYPE html>
405
+ <html>
406
+ <head>
407
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
408
+ <meta charset="utf-8">
409
+ <title>Logout Request</title>
410
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
411
+ <style>
412
+ @import url(https://fonts.googleapis.com/css?family=Roboto:400,100);button,h1{text-align:center}h1{font-weight:100;font-size:1.3em}body{font-family:Roboto,sans-serif;margin-top:25px;margin-bottom:25px}.container{padding:0 40px 10px;width:274px;background-color:#F7F7F7;margin:0 auto 10px;border-radius:2px;box-shadow:0 2px 2px rgba(0,0,0,.3);overflow:hidden}button{font-size:14px;font-family:Arial,sans-serif;font-weight:700;height:36px;padding:0 8px;width:100%;display:block;margin-bottom:10px;position:relative;border:0;color:#fff;text-shadow:0 1px rgba(0,0,0,.1);background-color:#4d90fe;cursor:pointer}button:hover{border:0;text-shadow:0 1px rgba(0,0,0,.3);background-color:#357ae8}
413
+ </style>
414
+ </head>
415
+ <body>
416
+ <div class="container">
417
+ <h1>Do you want to sign-out from ${ctx.host}?</h1>
418
+ ${form}
419
+ <button autofocus type="submit" form="op.logoutForm" value="yes" name="logout">Yes, sign me out</button>
420
+ <button type="submit" form="op.logoutForm">No, stay signed in</button>
421
+ </div>
422
+ </body>
423
+ </html>`;
424
+ }
425
+
426
+ async function renderError(ctx, out, error) {
427
+ shouldChange('renderError', 'customize the look of the error page');
428
+ ctx.type = 'html';
429
+ ctx.body = `<!DOCTYPE html>
430
+ <html>
431
+ <head>
432
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
433
+ <meta charset="utf-8">
434
+ <title>oops! something went wrong</title>
435
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
436
+ <style>
437
+ @import url(https://fonts.googleapis.com/css?family=Roboto:400,100);h1{font-weight:100;text-align:center;font-size:2.3em}body{font-family:Roboto,sans-serif;margin-top:25px;margin-bottom:25px}.container{padding:0 40px 10px;width:274px;background-color:#F7F7F7;margin:0 auto 10px;border-radius:2px;box-shadow:0 2px 2px rgba(0,0,0,.3);overflow:hidden}pre{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;margin:0 0 0 1em;text-indent:-1em}
438
+ </style>
439
+ </head>
440
+ <body>
441
+ <div class="container">
442
+ <h1>oops! something went wrong</h1>
443
+ ${Object.entries(out).map(([key, value]) => `<pre><strong>${key}</strong>: ${htmlSafe(value)}</pre>`).join('')}
444
+ </div>
445
+ </body>
446
+ </html>`;
447
+ }
448
+
449
+ async function interactionsUrl(ctx, interaction) {
450
+ return `/interaction/${interaction.uid}`;
451
+ }
452
+
453
+ async function findAccount(ctx, sub, token) {
454
+ // @param ctx - koa request context
455
+ // @param sub {string} - account identifier (subject)
456
+ // @param token - is a reference to the token used for which a given account is being loaded,
457
+ // is undefined in scenarios where claims are returned from authorization endpoint
458
+ mustChange('findAccount', 'use your own account model');
459
+ return {
460
+ accountId: sub,
461
+ // @param use {string} - can either be "id_token" or "userinfo", depending on
462
+ // where the specific claims are intended to be put in
463
+ // @param scope {string} - the intended scope, while oidc-provider will mask
464
+ // claims depending on the scope automatically you might want to skip
465
+ // loading some claims from external resources or through db projection etc. based on this
466
+ // detail or not return them in ID Tokens but only UserInfo and so on
467
+ // @param claims {object} - the part of the claims authorization parameter for either
468
+ // "id_token" or "userinfo" (depends on the "use" param)
469
+ // @param rejected {Array[String]} - claim names that were rejected by the end-user, you might
470
+ // want to skip loading some claims from external resources or through db projection
471
+ async claims(use, scope, claims, rejected) {
472
+ return { sub };
473
+ },
474
+ };
475
+ }
476
+
477
+ function rotateRefreshToken(ctx) {
478
+ const { RefreshToken: refreshToken, Client: client } = ctx.oidc.entities;
479
+
480
+ // cap the maximum amount of time a refresh token can be
481
+ // rotated for up to 1 year, afterwards its TTL is final
482
+ if (refreshToken.totalLifetime() >= 365.25 * 24 * 60 * 60) {
483
+ return false;
484
+ }
485
+
486
+ // rotate non sender-constrained public client refresh tokens
487
+ if (
488
+ client.clientAuthMethod === 'none'
489
+ && !refreshToken.isSenderConstrained()
490
+ ) {
491
+ return true;
492
+ }
493
+
494
+ // rotate if the token is nearing expiration (it's beyond 70% of its lifetime)
495
+ return refreshToken.ttlPercentagePassed() >= 70;
496
+ }
497
+
498
+ async function loadExistingGrant(ctx) {
499
+ const grantId = ctx.oidc.result?.consent?.grantId
500
+ || ctx.oidc.session.grantIdFor(ctx.oidc.client.clientId);
501
+
502
+ if (grantId) {
503
+ return ctx.oidc.provider.Grant.find(grantId);
504
+ }
505
+ return undefined;
506
+ }
507
+
508
+ function revokeGrantPolicy(ctx) {
509
+ if (ctx.oidc.route === 'revocation' && ctx.oidc.entities.AccessToken) {
510
+ return false;
511
+ }
512
+ return true;
513
+ }
514
+
515
+ function sectorIdentifierUriValidate(client) {
516
+ // @param client - the Client instance
517
+ return true;
518
+ }
519
+
520
+ async function processLoginHintToken(ctx, loginHintToken) {
521
+ // @param ctx - koa request context
522
+ // @param loginHintToken - string value of the login_hint_token parameter
523
+ mustChange('features.ciba.processLoginHintToken', 'process the login_hint_token parameter and return the accountId value to use for processing the request');
524
+ throw new Error('features.ciba.processLoginHintToken not implemented');
525
+ }
526
+
527
+ async function processLoginHint(ctx, loginHint) {
528
+ // @param ctx - koa request context
529
+ // @param loginHint - string value of the login_hint parameter
530
+ mustChange('features.ciba.processLoginHint', 'process the login_hint parameter and return the accountId value to use for processing the request');
531
+ throw new Error('features.ciba.processLoginHint not implemented');
532
+ }
533
+
534
+ async function verifyUserCode(ctx, account, userCode) {
535
+ // @param ctx - koa request context
536
+ // @param account -
537
+ // @param userCode - string value of the user_code parameter, when not provided it is undefined
538
+ mustChange('features.ciba.verifyUserCode', 'verify the user_code parameter is present when required and verify its value');
539
+ throw new Error('features.ciba.verifyUserCode not implemented');
540
+ }
541
+
542
+ async function validateBindingMessage(ctx, bindingMessage) {
543
+ // @param ctx - koa request context
544
+ // @param bindingMessage - string value of the binding_message parameter, when not provided it is undefined
545
+ shouldChange('features.ciba.validateBindingMessage', 'verify the binding_message parameter is present when required and verify its value');
546
+ if (bindingMessage?.match(/^[a-zA-Z0-9-._+/!?#]{1,20}$/) === null) {
547
+ throw new errors.InvalidBindingMessage(
548
+ 'the binding_message value, when provided, needs to be 1 - 20 characters in length and use only a basic set of characters (matching the regex: ^[a-zA-Z0-9-._+/!?#]{1,20}$ )',
549
+ );
550
+ }
551
+ }
552
+
553
+ async function validateRequestContext(ctx, requestContext) {
554
+ // @param ctx - koa request context
555
+ // @param requestContext - string value of the request_context parameter, when not provided it is undefined
556
+ mustChange('features.ciba.validateRequestContext', 'verify the request_context parameter is present when required and verify its value');
557
+ throw new Error('features.ciba.validateRequestContext not implemented');
558
+ }
559
+
560
+ async function triggerAuthenticationDevice(ctx, request, account, client) {
561
+ // @param ctx - koa request context
562
+ // @param request - the BackchannelAuthenticationRequest instance
563
+ // @param account - the account object retrieved by findAccount
564
+ // @param client - the Client instance
565
+ mustChange('features.ciba.triggerAuthenticationDevice', "to trigger the authentication and authorization process on end-user's Authentication Device");
566
+ throw new Error('features.ciba.triggerAuthenticationDevice not implemented');
567
+ }
568
+
569
+ async function assertClaimsParameter(ctx, claims, client) {
570
+ // @param ctx - koa request context
571
+ // @param claims - parsed claims parameter
572
+ // @param client - the Client instance
573
+ }
574
+
575
+ async function assertJwtClientAuthClaimsAndHeader(ctx, claims, header, client) {
576
+ // @param ctx - koa request context
577
+ // @param claims - parsed JWT Client Authentication Assertion Claims Set as object
578
+ // @param header - parsed JWT Client Authentication Assertion Headers as object
579
+ // @param client - the Client instance
580
+
581
+ if (ctx.oidc.isFapi('2.0') && claims.aud !== ctx.oidc.issuer) {
582
+ throw new errors.InvalidClientAuth(
583
+ 'audience (aud) must equal the issuer identifier url',
584
+ );
585
+ }
586
+ }
587
+
588
+ async function assertJwtClaimsAndHeader(ctx, claims, header, client) {
589
+ // @param ctx - koa request context
590
+ // @param claims - parsed Request Object JWT Claims Set as object
591
+ // @param header - parsed Request Object JWT Headers as object
592
+ // @param client - the Client instance
593
+
594
+ const requiredClaims = [];
595
+ const fapiProfile = ctx.oidc.isFapi('1.0 Final', '2.0');
596
+
597
+ if (fapiProfile) {
598
+ requiredClaims.push('exp', 'aud', 'nbf');
599
+ }
600
+
601
+ if (ctx.oidc.route === 'backchannel_authentication') {
602
+ requiredClaims.push('exp', 'iat', 'nbf', 'jti');
603
+ }
604
+
605
+ for (const claim of new Set(requiredClaims)) {
606
+ if (claims[claim] === undefined) {
607
+ throw new errors.InvalidRequestObject(
608
+ `Request Object is missing the '${claim}' claim`,
609
+ );
610
+ }
611
+ }
612
+
613
+ if (fapiProfile) {
614
+ const diff = claims.exp - claims.nbf;
615
+ if (Math.sign(diff) !== 1 || diff > 3600) {
616
+ throw new errors.InvalidRequestObject(
617
+ "Request Object 'exp' claim too far from 'nbf' claim",
618
+ );
619
+ }
620
+ }
621
+ }
622
+
623
+ function makeDefaults() {
624
+ const defaults = {
625
+ /*
626
+ * acrValues
627
+ *
628
+ * title: Authentication Context Class References
629
+ *
630
+ * description: An array of strings representing the Authentication Context Class References
631
+ * that this authorization server supports.
632
+ */
633
+ acrValues: [],
634
+
635
+ /*
636
+ * adapter
637
+ *
638
+ * @important
639
+ *
640
+ * title: Storage Adapter
641
+ *
642
+ * description: Specifies the storage adapter implementation for persisting authorization server
643
+ * state. The default implementation provides a basic in-memory adapter suitable for development
644
+ * and testing purposes only. When this process is restarted, all stored information will be lost.
645
+ * Production deployments MUST provide a custom adapter implementation that persists data to
646
+ * external storage (e.g., database, Redis, etc.).
647
+ *
648
+ * The adapter constructor will be instantiated for each model type when first accessed.
649
+ *
650
+ * see: [The expected interface](/example/my_adapter.js)
651
+ * see: [Example MongoDB adapter implementation](https://github.com/panva/node-oidc-provider/discussions/1308)
652
+ * see: [Example Redis adapter implementation](https://github.com/panva/node-oidc-provider/discussions/1309)
653
+ * see: [Example Redis w/ JSON Adapter](https://github.com/panva/node-oidc-provider/discussions/1310)
654
+ * see: [Default in-memory adapter implementation](/lib/adapters/memory_adapter.js)
655
+ * see: [Community Contributed Adapter Archive](https://github.com/panva/node-oidc-provider/discussions/1311)
656
+ *
657
+ * @nodefault
658
+ */
659
+ adapter: undefined,
660
+
661
+ /*
662
+ * claims
663
+ *
664
+ * @important
665
+ *
666
+ * title: Available Claims
667
+ *
668
+ * description: Describes the claims that this authorization server may be able to supply values for.
669
+ *
670
+ * It is used to achieve two different things related to claims:
671
+ * - which additional claims are available to RPs (configure as `{ claimName: null }`)
672
+ * - which claims fall under what scope (configure `{ scopeName: ['claim', 'another-claim'] }`)
673
+ *
674
+ * see: [Configuring OpenID Connect 1.0 Standard Claims](https://github.com/panva/node-oidc-provider/discussions/1299)
675
+ */
676
+ claims: {
677
+ acr: null,
678
+ sid: null,
679
+ auth_time: null,
680
+ iss: null,
681
+ openid: ['sub'],
682
+ },
683
+
684
+ /*
685
+ * clientBasedCORS
686
+ *
687
+ * @important
688
+ *
689
+ * title: Cross-Origin Resource Sharing (CORS)
690
+ *
691
+ * description: Specifies a function that determines whether Cross-Origin Resource Sharing (CORS)
692
+ * requests shall be permitted based on the requesting client. This function
693
+ * is invoked for each actual CORS request to evaluate the client's authorization
694
+ * to access the authorization server from the specified origin.
695
+ * The function receives three arguments: `ctx` (the Koa request context),
696
+ * `origin` (the requesting origin string), and `client` (the resolved Client instance).
697
+ * It must return a boolean (or a Promise resolving to one).
698
+ *
699
+ * see: [Configuring Client Metadata-based CORS Origin allow list](https://github.com/panva/node-oidc-provider/discussions/1298)
700
+ */
701
+ clientBasedCORS,
702
+
703
+ /*
704
+ * clients
705
+ *
706
+ * @important
707
+ *
708
+ * title: Statically Configured Clients
709
+ *
710
+ * description: An array of client metadata objects representing statically configured OAuth 2.0
711
+ * and OpenID Connect clients. These clients are persistent, do not expire, and remain available
712
+ * throughout the authorization server's lifetime. For dynamic client resolution, the authorization
713
+ * server will invoke the adapter's `find` method when encountering unregistered client identifiers.
714
+ *
715
+ * To restrict the authorization server to only statically configured clients and disable dynamic
716
+ * registration, configure the adapter to return falsy values for client lookup operations
717
+ * (e.g., `return Promise.resolve()`).
718
+ *
719
+ * Each client's metadata shall be validated according to the specifications in which the respective
720
+ * properties are defined.
721
+ *
722
+ * example: Available Metadata.
723
+ *
724
+ * application_type, client_id, client_name, client_secret, client_uri, contacts,
725
+ * default_acr_values, default_max_age, grant_types, id_token_signed_response_alg,
726
+ * initiate_login_uri, jwks, jwks_uri, logo_uri, policy_uri,
727
+ * redirect_uris, require_auth_time, response_types, response_modes, scope, sector_identifier_uri,
728
+ * subject_type, token_endpoint_auth_method, tos_uri
729
+ *
730
+ * The following metadata is available but may not be recognized depending on this
731
+ * authorization server's configuration.
732
+ *
733
+ * authorization_details_types, authorization_encrypted_response_alg,
734
+ * authorization_encrypted_response_enc, authorization_signed_response_alg,
735
+ * backchannel_authentication_request_signing_alg, backchannel_client_notification_endpoint,
736
+ * backchannel_logout_session_required, backchannel_logout_uri,
737
+ * backchannel_token_delivery_mode, backchannel_user_code_parameter,
738
+ * dpop_bound_access_tokens, id_token_encrypted_response_alg,
739
+ * id_token_encrypted_response_enc, introspection_encrypted_response_alg,
740
+ * introspection_encrypted_response_enc, introspection_signed_response_alg,
741
+ * post_logout_redirect_uris,
742
+ * request_object_encryption_alg, request_object_encryption_enc, request_object_signing_alg,
743
+ * require_pushed_authorization_requests, require_signed_request_object,
744
+ * tls_client_auth_san_dns, tls_client_auth_san_email, tls_client_auth_san_ip,
745
+ * tls_client_auth_san_uri, tls_client_auth_subject_dn,
746
+ * tls_client_certificate_bound_access_tokens,
747
+ * token_endpoint_auth_signing_alg, use_mtls_endpoint_aliases,
748
+ * userinfo_encrypted_response_alg, userinfo_encrypted_response_enc,
749
+ * userinfo_signed_response_alg
750
+ */
751
+ clients: [],
752
+
753
+ /*
754
+ * clientDefaults
755
+ *
756
+ * title: Default Client Metadata
757
+ *
758
+ * description: Specifies default client metadata values that shall be applied when properties
759
+ * are not explicitly provided during Dynamic Client Registration or for statically configured
760
+ * clients. This configuration allows override of the authorization server's built-in default
761
+ * values for any supported client metadata property.
762
+ *
763
+ * example: Changing the default client token_endpoint_auth_method.
764
+ *
765
+ * To change the default client token_endpoint_auth_method, configure `clientDefaults` to be an
766
+ * object like so:
767
+ *
768
+ * ```js
769
+ * {
770
+ * token_endpoint_auth_method: 'client_secret_post'
771
+ * }
772
+ * ```
773
+ * example: Changing the default client response type to `code id_token`.
774
+ *
775
+ * To change the default client response_types, configure `clientDefaults` to be an
776
+ * object like so:
777
+ *
778
+ * ```js
779
+ * {
780
+ * response_types: ['code id_token'],
781
+ * grant_types: ['authorization_code', 'implicit'],
782
+ * }
783
+ * ```
784
+ *
785
+ */
786
+ clientDefaults: {
787
+ grant_types: ['authorization_code'],
788
+ id_token_signed_response_alg: 'RS256',
789
+ response_types: ['code'],
790
+ token_endpoint_auth_method: 'client_secret_basic',
791
+ },
792
+
793
+ /*
794
+ * clockTolerance
795
+ *
796
+ * title: Clock Skew Tolerance
797
+ *
798
+ * description: Specifies the maximum acceptable clock skew tolerance (in seconds) for validating
799
+ * time-sensitive operations, including JWT validation for Request Objects and
800
+ * other timestamp-based security mechanisms.
801
+ *
802
+ * recommendation: This value should be kept as small as possible while accommodating expected
803
+ * clock drift between the authorization server and client systems.
804
+ */
805
+ clockTolerance: 15,
806
+
807
+ /*
808
+ * conformIdTokenClaims
809
+ *
810
+ * title: ID Token Claims Conformance
811
+ *
812
+ * description: [`OIDC Core 1.0` - Requesting Claims using Scope Values](https://openid.net/specs/openid-connect-core-1_0-errata2.html#ScopeClaims)
813
+ * defines that claims requested using the `scope` parameter are only returned from the UserInfo
814
+ * Endpoint unless the `response_type` is `id_token`.
815
+ *
816
+ * Despite this configuration, the ID Token always includes claims requested using the `scope`
817
+ * parameter when the userinfo endpoint is disabled, or when issuing an Access Token not applicable
818
+ * for access to the userinfo endpoint.
819
+ *
820
+ */
821
+ conformIdTokenClaims: true,
822
+
823
+ /*
824
+ * loadExistingGrant
825
+ *
826
+ * title: Loading Existing Grants
827
+ *
828
+ * description: Helper function invoked to load existing authorization grants that may be used
829
+ * to resolve an Authorization Request without requiring additional end-user interaction.
830
+ * The default implementation attempts to load grants based on the interaction result's
831
+ * `consent.grantId` property, falling back to the existing grantId for the requesting client
832
+ * in the current session.
833
+ */
834
+ loadExistingGrant,
835
+
836
+ /*
837
+ * allowOmittingSingleRegisteredRedirectUri
838
+ *
839
+ * title: Redirect URI Parameter Omission for Single Registered URI
840
+ *
841
+ * description: Specifies whether clients may omit the `redirect_uri` parameter in authorization
842
+ * requests when only a single redirect URI is registered in their client metadata. When enabled,
843
+ * the authorization server shall automatically use the sole registered redirect URI for clients
844
+ * that have exactly one URI configured.
845
+ *
846
+ * When disabled, all authorization requests MUST explicitly include the `redirect_uri` parameter
847
+ * regardless of the number of registered redirect URIs.
848
+ */
849
+ allowOmittingSingleRegisteredRedirectUri: true,
850
+
851
+ /*
852
+ * acceptQueryParamAccessTokens
853
+ *
854
+ * title: Query Parameter Access Tokens
855
+ *
856
+ * description: Controls whether access tokens may be transmitted via URI query parameters.
857
+ * Several OAuth 2.0 and OpenID Connect profiles require that access tokens be transmitted
858
+ * exclusively via the Authorization header. When set to false, the authorization server
859
+ * shall reject requests attempting to transmit access tokens via query parameters.
860
+ *
861
+ */
862
+ acceptQueryParamAccessTokens: false,
863
+
864
+ /*
865
+ * cookies
866
+ *
867
+ * title: HTTP Cookie Configuration
868
+ *
869
+ * description: Configuration for HTTP cookies used to maintain User-Agent state throughout
870
+ * the authorization flow. These settings conform to the
871
+ * [cookies module interface specification](https://github.com/pillarjs/cookies/tree/0.9.1?tab=readme-ov-file#cookiessetname--values--options).
872
+ * The `maxAge` and `expires` properties are ignored; cookie lifetimes are instead controlled
873
+ * via the `ttl.Session` and `ttl.Interaction` configuration parameters.
874
+ * @nodefault
875
+ */
876
+ cookies: {
877
+ /*
878
+ * cookies.names
879
+ *
880
+ * description: Specifies the HTTP cookie names used for state management during the
881
+ * authorization flow.
882
+ */
883
+ names: {
884
+ session: '_session', // used for main session reference
885
+ interaction: '_interaction', // used by the interactions for interaction session reference
886
+ resume: '_interaction_resume', // used when interactions resume authorization for interaction session reference
887
+ },
888
+
889
+ /*
890
+ * cookies.long
891
+ *
892
+ * description: Options for long-term cookies.
893
+ */
894
+ long: {
895
+ httpOnly: true, // cookies are not readable by client-side JavaScript
896
+ sameSite: 'lax',
897
+ },
898
+
899
+ /*
900
+ * cookies.short
901
+ *
902
+ * description: Options for short-term cookies.
903
+ */
904
+ short: {
905
+ httpOnly: true, // cookies are not readable by client-side JavaScript
906
+ sameSite: 'lax',
907
+ },
908
+
909
+ /*
910
+ * cookies.keys
911
+ *
912
+ * description: [Keygrip](https://www.npmjs.com/package/keygrip) signing keys used for cookie
913
+ * signing to prevent tampering. You may also pass your own KeyGrip instance.
914
+ *
915
+ * recommendation: Rotate regularly (by prepending new keys) with a reasonable interval and keep
916
+ * a reasonable history of keys to allow for returning user session cookies to still be valid
917
+ * and re-signed.
918
+ *
919
+ * @skip
920
+ */
921
+ keys: [],
922
+ },
923
+
924
+ /*
925
+ * discovery
926
+ *
927
+ * title: Extending the Discovery Document
928
+ *
929
+ * description: Pass additional properties to this object to extend the discovery document.
930
+ *
931
+ * Note: Standard discovery properties derived from the provider's configuration cannot be
932
+ * overridden through this object.
933
+ */
934
+ discovery: {
935
+ claim_types_supported: ['normal'],
936
+ claims_locales_supported: undefined,
937
+ display_values_supported: undefined,
938
+ op_policy_uri: undefined,
939
+ op_tos_uri: undefined,
940
+ service_documentation: undefined,
941
+ ui_locales_supported: undefined,
942
+ },
943
+
944
+ /*
945
+ * extraParams
946
+ *
947
+ * title: Additional Authorization Request Parameters
948
+ *
949
+ * description: Specifies additional parameters that shall be recognized by the authorization,
950
+ * device authorization, backchannel authentication, and pushed authorization request endpoints.
951
+ * These extended parameters become available in `ctx.oidc.params` and are passed to interaction
952
+ * session details for processing.
953
+ *
954
+ * This configuration accepts either an iterable object (array or Set of strings) for simple
955
+ * parameter registration, or a plain object with string properties representing parameter names
956
+ * and values being validation functions (synchronous or asynchronous) for the corresponding
957
+ * parameter values.
958
+ *
959
+ * Parameter validators are executed regardless of the parameter's presence or value, enabling
960
+ * validation of parameter presence as well as assignment of default values. When the value
961
+ * is `null` or `undefined`, the parameter is registered without validation constraints.
962
+ *
963
+ * Note: These validators execute during the final phase of the request validation process.
964
+ * Modifications to other parameters (such as assigning default values) will not trigger
965
+ * re-validation of the entire request.
966
+ *
967
+ * example: Registering an extra `origin` parameter with its validator.
968
+ *
969
+ * ```js
970
+ * import { errors } from 'oidc-provider';
971
+ *
972
+ * const extraParams = {
973
+ * async origin(ctx, value, client) {
974
+ * // @param ctx - koa request context
975
+ * // @param value - the `origin` parameter value (string or undefined)
976
+ * // @param client - client making the request
977
+ *
978
+ * if (hasDefaultOrigin(client)) {
979
+ * // assign default
980
+ * ctx.oidc.params.origin ||= value ||= getDefaultOrigin(client);
981
+ * }
982
+ *
983
+ * if (!value && requiresOrigin(ctx, client)) {
984
+ * // reject when missing but required
985
+ * throw new errors.InvalidRequest('"origin" is required for this request')
986
+ * }
987
+ *
988
+ * if (!allowedOrigin(value, client)) {
989
+ * // reject when not allowed
990
+ * throw new errors.InvalidRequest('requested "origin" is not allowed for this client')
991
+ * }
992
+ * }
993
+ * }
994
+ * ```
995
+ */
996
+ extraParams: [],
997
+
998
+ /*
999
+ * features
1000
+ *
1001
+ * @important
1002
+ *
1003
+ * title: Feature Configurations
1004
+ *
1005
+ * description: Specifies the authorization server feature capabilities that shall be enabled
1006
+ * or disabled. This configuration controls the availability of optional OAuth 2.0 and
1007
+ * OpenID Connect extensions, experimental specifications, and proprietary enhancements.
1008
+ *
1009
+ * Certain features may be designated as experimental implementations. When experimental
1010
+ * features are enabled, the authorization server will emit warnings to indicate that
1011
+ * breaking changes may occur in future releases. These changes will be published as
1012
+ * minor version updates of the oidc-provider module.
1013
+ *
1014
+ * To suppress experimental feature warnings and ensure configuration validation against
1015
+ * breaking changes, implementations shall acknowledge the specific experimental feature
1016
+ * version using the acknowledgment mechanism demonstrated in the example below. When
1017
+ * an unacknowledged breaking change is detected, the authorization server configuration
1018
+ * will throw an error during instantiation.
1019
+ *
1020
+ * example: Acknowledging an experimental feature.
1021
+ *
1022
+ * ```js
1023
+ * import * as oidc from 'oidc-provider'
1024
+ *
1025
+ * new oidc.Provider('http://localhost:3000', {
1026
+ * features: {
1027
+ * webMessageResponseMode: {
1028
+ * enabled: true,
1029
+ * },
1030
+ * },
1031
+ * });
1032
+ *
1033
+ * // The above code produces this NOTICE
1034
+ * // NOTICE: The following experimental features are enabled and their implemented version not acknowledged
1035
+ * // NOTICE: - OAuth 2.0 Web Message Response Mode - draft 01 (Acknowledging this feature's implemented version can be done with the value 'individual-draft-01')
1036
+ * // NOTICE: Breaking changes between experimental feature updates may occur and these will be published as MINOR semver oidc-provider updates.
1037
+ * // NOTICE: You may disable this notice and be warned when breaking updates occur by acknowledging the current experiment's version. See the documentation for more details.
1038
+ *
1039
+ * new oidc.Provider('http://localhost:3000', {
1040
+ * features: {
1041
+ * webMessageResponseMode: {
1042
+ * enabled: true,
1043
+ * ack: 'individual-draft-01',
1044
+ * },
1045
+ * },
1046
+ * });
1047
+ * // No more NOTICE, at this point if the experimental was updated and contained no breaking
1048
+ * // changes, you're good to go, still no NOTICE, your code is safe to run.
1049
+ *
1050
+ * // Now let's assume you upgrade oidc-provider version and it includes a breaking change in
1051
+ * // this experimental feature
1052
+ * new oidc.Provider('http://localhost:3000', {
1053
+ * features: {
1054
+ * webMessageResponseMode: {
1055
+ * enabled: true,
1056
+ * ack: 'individual-draft-01',
1057
+ * },
1058
+ * },
1059
+ * });
1060
+ * // Thrown:
1061
+ * // Error: An unacknowledged version of an experimental feature is included in this oidc-provider version.
1062
+ * ```
1063
+ * @nodefault
1064
+ */
1065
+ features: {
1066
+ /*
1067
+ * features.devInteractions
1068
+ *
1069
+ * @important
1070
+ *
1071
+ * title: Development-only Interaction Views
1072
+ *
1073
+ * description: Enables development-only interaction views that provide pre-built user
1074
+ * interface components for rapid prototyping and testing of authorization flows. These
1075
+ * views accept any username (used as the subject claim value) and any password for
1076
+ * authentication, bypassing production-grade security controls.
1077
+ *
1078
+ * Production deployments MUST disable this feature and implement proper end-user
1079
+ * authentication and authorization mechanisms. These development views MUST NOT
1080
+ * be used in production environments as they provide no security guarantees and
1081
+ * accept arbitrary credentials.
1082
+ */
1083
+ devInteractions: { enabled: true },
1084
+
1085
+ /*
1086
+ * features.dPoP
1087
+ *
1088
+ * title: [RFC9449](https://www.rfc-editor.org/rfc/rfc9449.html) - OAuth 2.0 Demonstration of Proof-of-Possession at the Application Layer (DPoP)
1089
+ *
1090
+ * description: Specifies whether sender-constraining of OAuth 2.0 tokens through application-level
1091
+ * proof-of-possession mechanisms shall be enabled.
1092
+ */
1093
+ dPoP: {
1094
+ enabled: true,
1095
+
1096
+ /*
1097
+ * features.dPoP.nonceSecret
1098
+ *
1099
+ * description: Specifies the cryptographic secret value used for generating server-provided
1100
+ * DPoP nonces. When provided, this value MUST be a 32-byte
1101
+ * Buffer instance to ensure sufficient entropy for secure nonce generation.
1102
+ */
1103
+ nonceSecret: undefined,
1104
+ /*
1105
+ * features.dPoP.requireNonce
1106
+ *
1107
+ * description: Specifies a function that determines whether a DPoP nonce shall be required
1108
+ * for proof-of-possession validation in the current request context. This function is
1109
+ * invoked during DPoP proof validation to enforce nonce requirements based on
1110
+ * authorization server policy.
1111
+ */
1112
+ requireNonce,
1113
+ /*
1114
+ * features.dPoP.allowReplay
1115
+ *
1116
+ * description: Specifies whether DPoP Proof replay shall be permitted by the
1117
+ * authorization server. When set to false, the server enforces strict replay protection
1118
+ * by rejecting previously used DPoP proofs, enhancing security against replay attacks.
1119
+ */
1120
+ allowReplay: false,
1121
+ },
1122
+
1123
+ /*
1124
+ * features.backchannelLogout
1125
+ *
1126
+ * title: [OIDC Back-Channel Logout 1.0](https://openid.net/specs/openid-connect-backchannel-1_0-final.html)
1127
+ *
1128
+ * description: Specifies whether Back-Channel Logout capabilities shall be enabled. When
1129
+ * enabled, the authorization server shall support propagating end-user logout events
1130
+ * to clients that were involved throughout the lifetime of the
1131
+ * terminated session.
1132
+ */
1133
+ backchannelLogout: { enabled: false },
1134
+
1135
+ /*
1136
+ * features.ciba
1137
+ *
1138
+ * title: [OIDC Client Initiated Backchannel Authentication Flow (CIBA)](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0-final.html)
1139
+ *
1140
+ * description: Specifies whether Core `CIBA` Flow shall be enabled. When combined with `features.fapi` and
1141
+ * `features.requestObjects` this also enables
1142
+ * [Financial-grade API: Client Initiated Backchannel Authentication Profile - Implementers Draft 01](https://openid.net/specs/openid-financial-api-ciba-ID1.html)
1143
+ * as well.
1144
+ *
1145
+ */
1146
+ ciba: {
1147
+ enabled: false,
1148
+
1149
+ /*
1150
+ * features.ciba.deliveryModes
1151
+ *
1152
+ * description: Specifies the token delivery modes supported by this authorization server.
1153
+ * The following delivery modes are defined:
1154
+ * - `poll` - Client polls the token endpoint for completion
1155
+ * - `ping` - Authorization server notifies client of completion via HTTP callback
1156
+ *
1157
+ */
1158
+ deliveryModes: ['poll'],
1159
+
1160
+ /*
1161
+ * features.ciba.triggerAuthenticationDevice
1162
+ *
1163
+ * description: Specifies a helper function that shall be invoked to initiate authentication
1164
+ * and authorization processes on the end-user's Authentication Device as defined in the
1165
+ * CIBA specification. This function is executed after accepting the backchannel
1166
+ * authentication request but before transmitting the response to the requesting client.
1167
+ *
1168
+ * Upon successful end-user authentication, implementations shall use `provider.backchannelResult()`
1169
+ * to complete the Consumption Device login process.
1170
+ *
1171
+ * example: `provider.backchannelResult()` method.
1172
+ *
1173
+ * `backchannelResult` is a method on the Provider prototype, it returns a `Promise` with no fulfillment value.
1174
+ *
1175
+ * ```js
1176
+ * import * as oidc from 'oidc-provider';
1177
+ * const provider = new oidc.Provider(...);
1178
+ * await provider.backchannelResult(...);
1179
+ * ```
1180
+ *
1181
+ * `backchannelResult(request, result[, options]);`
1182
+ * - `request` BackchannelAuthenticationRequest - BackchannelAuthenticationRequest instance.
1183
+ * - `result` Grant | OIDCProviderError - instance of a persisted Grant model or an OIDCProviderError (all exported by errors).
1184
+ * - `options.acr?`: string - Authentication Context Class Reference value that identifies the Authentication Context Class that the authentication performed satisfied.
1185
+ * - `options.amr?`: string[] - Identifiers for authentication methods used in the authentication.
1186
+ * - `options.authTime?`: number - Time when the end-user authentication occurred.
1187
+ *
1188
+ */
1189
+ triggerAuthenticationDevice,
1190
+
1191
+ /*
1192
+ * features.ciba.validateBindingMessage
1193
+ *
1194
+ * description: Specifies a helper function that shall be invoked to validate the
1195
+ * `binding_message` parameter according to authorization server policy. This function
1196
+ * MUST reject invalid binding messages by throwing appropriate error instances.
1197
+ *
1198
+ * recommendation: Use `throw new errors.InvalidBindingMessage('validation error message')`
1199
+ * when the binding_message violates authorization server policy.
1200
+ * recommendation: Use `return undefined` when a binding_message is not required by policy
1201
+ * and was not provided in the request.
1202
+ *
1203
+ */
1204
+ validateBindingMessage,
1205
+
1206
+ /*
1207
+ * features.ciba.validateRequestContext
1208
+ *
1209
+ * description: Specifies a helper function that shall be invoked to validate the
1210
+ * `request_context` parameter according to authorization server policy. This function
1211
+ * MUST enforce policy requirements for request context validation and reject
1212
+ * non-compliant requests.
1213
+ *
1214
+ * recommendation: Use `throw new errors.InvalidRequest('validation error message')`
1215
+ * when the request_context is required by policy but missing or invalid.
1216
+ * recommendation: Use `return undefined` when a request_context is not required by policy
1217
+ * and was not provided in the request.
1218
+ *
1219
+ */
1220
+ validateRequestContext,
1221
+
1222
+ /*
1223
+ * features.ciba.processLoginHintToken
1224
+ *
1225
+ * description: Specifies a helper function that shall be invoked to process the
1226
+ * `login_hint_token` parameter and extract the corresponding accountId value for
1227
+ * request processing. This function MUST validate token expiration and format
1228
+ * according to authorization server policy.
1229
+ *
1230
+ * recommendation: Use `throw new errors.ExpiredLoginHintToken('validation error message')`
1231
+ * when the login_hint_token has expired.
1232
+ * recommendation: Use `throw new errors.InvalidRequest('validation error message')`
1233
+ * when the login_hint_token format or content is invalid.
1234
+ * recommendation: Use `return undefined` when the accountId cannot be determined
1235
+ * from the provided login_hint_token.
1236
+ *
1237
+ */
1238
+ processLoginHintToken,
1239
+
1240
+ /*
1241
+ * features.ciba.processLoginHint
1242
+ *
1243
+ * description: Specifies a helper function that shall be invoked to process the
1244
+ * `login_hint` parameter and extract the corresponding accountId value for
1245
+ * request processing. This function MUST validate the hint format and content
1246
+ * according to authorization server policy.
1247
+ *
1248
+ * recommendation: Use `throw new errors.InvalidRequest('validation error message')`
1249
+ * when the login_hint format or content is invalid.
1250
+ * recommendation: Use `return undefined` when the accountId cannot be determined
1251
+ * from the provided login_hint.
1252
+ *
1253
+ */
1254
+ processLoginHint,
1255
+
1256
+ /*
1257
+ * features.ciba.verifyUserCode
1258
+ *
1259
+ * description: Specifies a helper function that shall be invoked to verify the presence
1260
+ * and validity of the `user_code` parameter when required by authorization server policy.
1261
+ *
1262
+ * recommendation: Use `throw new errors.MissingUserCode('validation error message')`
1263
+ * when user_code is required by policy but was not provided.
1264
+ * recommendation: Use `throw new errors.InvalidUserCode('validation error message')`
1265
+ * when the provided user_code value is invalid or does not meet policy requirements.
1266
+ * recommendation: Use `return undefined` when no user_code was provided and it is not
1267
+ * required by authorization server policy.
1268
+ *
1269
+ */
1270
+ verifyUserCode,
1271
+ },
1272
+
1273
+ /*
1274
+ * features.mTLS
1275
+ *
1276
+ * title: [RFC8705](https://www.rfc-editor.org/rfc/rfc8705.html) - OAuth 2.0 Mutual TLS Client Authentication and Certificate Bound Access Tokens (MTLS)
1277
+ *
1278
+ * description: Specifies whether Mutual TLS capabilities shall be enabled.
1279
+ * The authorization server supports three distinct capabilities that require separate configuration
1280
+ * settings within this feature's configuration object. Implementations MUST provide
1281
+ * deployment-specific helper functions for certificate validation and processing operations.
1282
+ *
1283
+ */
1284
+ mTLS: {
1285
+ enabled: false,
1286
+
1287
+ /*
1288
+ * features.mTLS.certificateBoundAccessTokens
1289
+ *
1290
+ * description: Specifies whether Certificate-Bound Access Tokens shall be enabled as
1291
+ * defined in RFC 8705 sections 3 and 4. When enabled, the authorization server shall
1292
+ * expose the client's `tls_client_certificate_bound_access_tokens` metadata property
1293
+ * for mutual TLS certificate binding functionality.
1294
+ */
1295
+ certificateBoundAccessTokens: false,
1296
+
1297
+ /*
1298
+ * features.mTLS.selfSignedTlsClientAuth
1299
+ *
1300
+ * description: Specifies whether Self-Signed Certificate Mutual TLS client authentication
1301
+ * shall be enabled as defined in RFC 8705 section 2.2. When enabled, the authorization
1302
+ * server shall support the `self_signed_tls_client_auth` authentication method within
1303
+ * the server's `clientAuthMethods` configuration.
1304
+ */
1305
+ selfSignedTlsClientAuth: false,
1306
+
1307
+ /*
1308
+ * features.mTLS.tlsClientAuth
1309
+ *
1310
+ * description: Specifies whether PKI Mutual TLS client authentication shall be enabled
1311
+ * as defined in RFC 8705 section 2.1. When enabled, the authorization server shall
1312
+ * support the `tls_client_auth` authentication method within the server's
1313
+ * `clientAuthMethods` configuration.
1314
+ */
1315
+ tlsClientAuth: false,
1316
+
1317
+ /*
1318
+ * features.mTLS.getCertificate
1319
+ *
1320
+ * description: Specifies a helper function that shall be invoked to retrieve the client
1321
+ * certificate used in the current request. This function MUST return either a
1322
+ * `crypto.X509Certificate` instance or a PEM-formatted string representation of
1323
+ * the client certificate for mutual TLS processing.
1324
+ */
1325
+ getCertificate,
1326
+
1327
+ /*
1328
+ * features.mTLS.certificateAuthorized
1329
+ *
1330
+ * description: Specifies a helper function that shall be invoked to determine whether
1331
+ * the client certificate used in the request is verified and originates from a trusted
1332
+ * Certificate Authority for the requesting client. This function MUST return a boolean
1333
+ * value indicating certificate authorization status. This validation is exclusively
1334
+ * used for the `tls_client_auth` client authentication method.
1335
+ */
1336
+ certificateAuthorized,
1337
+
1338
+ /*
1339
+ * features.mTLS.certificateSubjectMatches
1340
+ *
1341
+ * description: Specifies a helper function that shall be invoked to determine whether
1342
+ * the client certificate subject used in the request matches the registered client
1343
+ * property according to authorization server policy. This function MUST return a
1344
+ * boolean value indicating subject matching status. This validation is exclusively
1345
+ * used for the `tls_client_auth` client authentication method.
1346
+ */
1347
+ certificateSubjectMatches,
1348
+ },
1349
+
1350
+ /*
1351
+ * features.attestClientAuth
1352
+ *
1353
+ * title: [draft-ietf-oauth-attestation-based-client-auth-06](https://www.ietf.org/archive/id/draft-ietf-oauth-attestation-based-client-auth-06.html) - OAuth 2.0 Attestation-Based Client Authentication
1354
+ *
1355
+ * description: Specifies whether Attestation-Based Client Authentication capabilities
1356
+ * shall be enabled. When enabled, the
1357
+ * authorization server shall support the `attest_jwt_client_auth` authentication
1358
+ * method within the server's `clientAuthMethods` configuration. This mechanism
1359
+ * enables Client Instances to authenticate using a Client Attestation JWT issued
1360
+ * by a trusted Client Attester and a corresponding Client Attestation Proof-of-Possession
1361
+ * JWT generated by the Client Instance.
1362
+ *
1363
+ */
1364
+ attestClientAuth: {
1365
+ ack: undefined,
1366
+ enabled: false,
1367
+
1368
+ /*
1369
+ * features.attestClientAuth.challengeSecret
1370
+ *
1371
+ * description: Specifies the cryptographic secret value used for generating server-provided
1372
+ * challenges. This value MUST be a 32-byte
1373
+ * Buffer instance to ensure sufficient entropy for secure challenge generation.
1374
+ */
1375
+ challengeSecret: undefined,
1376
+
1377
+ /*
1378
+ * features.attestClientAuth.getAttestationSignaturePublicKey
1379
+ *
1380
+ * description: Specifies a helper function that shall be invoked to verify the issuer
1381
+ * identifier of a Client Attestation JWT and retrieve the public key used for signature
1382
+ * verification. At the point of this function's invocation, only the
1383
+ * JWT format has been validated; no cryptographic or claims verification has occurred.
1384
+ *
1385
+ * The function MUST return a public key in one of the supported formats: CryptoKey,
1386
+ * KeyObject, or JSON Web Key (JWK) representation. The authorization server shall
1387
+ * use this key to verify the Client Attestation JWT signature.
1388
+ *
1389
+ * example: Fetching attester public keys from the attester's hosted JWKS
1390
+ *
1391
+ * ```js
1392
+ * import * as jose from 'jose';
1393
+ *
1394
+ * const attesters = new Map(Object.entries({
1395
+ * 'https://attester.example.com': jose.createRemoteJWKSet(new URL('https://attester.example.com/jwks')),
1396
+ * }));
1397
+ *
1398
+ * function getAttestationSignaturePublicKey(ctx, iss, header, client) {
1399
+ * if (attesters.has(iss)) return attesters.get(iss)(header);
1400
+ * throw new Error('unsupported oauth-client-attestation issuer');
1401
+ * }
1402
+ * ```
1403
+ */
1404
+ getAttestationSignaturePublicKey,
1405
+
1406
+ /*
1407
+ * features.attestClientAuth.assertAttestationJwtAndPop
1408
+ *
1409
+ * description: Specifies a helper function that shall be invoked to perform additional
1410
+ * validation of the Client Attestation JWT and Client Attestation Proof-of-Possession
1411
+ * JWT beyond the specification requirements. This enables enforcement of extension
1412
+ * profiles, deployment-specific policies, or additional security constraints.
1413
+ *
1414
+ * At the point of invocation, both JWTs have undergone signature verification and
1415
+ * standard validity claim validation. The function may throw errors to reject
1416
+ * non-compliant attestations
1417
+ * or return successfully to indicate acceptance of the client authentication attempt.
1418
+ */
1419
+ assertAttestationJwtAndPop,
1420
+ },
1421
+
1422
+ /*
1423
+ * features.clientIdMetadataDocument
1424
+ *
1425
+ * title: [`draft-ietf-oauth-client-id-metadata-document-01`](https://www.ietf.org/archive/id/draft-ietf-oauth-client-id-metadata-document-01.html) - OAuth Client ID Metadata Document (CIMD)
1426
+ *
1427
+ * description: Specifies whether the authorization server shall support resolving client
1428
+ * metadata from HTTPS URLs used as `client_id` values. When enabled, if a `client_id`
1429
+ * is an HTTPS URL conforming to the specification's requirements, the authorization
1430
+ * server shall fetch the client metadata document from that URL and use it as the client's
1431
+ * registration data, without requiring prior client registration.
1432
+ *
1433
+ */
1434
+ clientIdMetadataDocument: {
1435
+ ack: undefined,
1436
+ enabled: false,
1437
+
1438
+ /**
1439
+ * features.clientIdMetadataDocument.allowFetch
1440
+ *
1441
+ * description: Specifies a helper function that shall be invoked before fetching a client
1442
+ * metadata document from a `client_id` URL. This function enables enforcement of
1443
+ * domain allowlisting, rate limiting, or other security policies.
1444
+ * Return `true` to allow the fetch, or `false` to reject the `client_id`.
1445
+ */
1446
+ async allowFetch(ctx, clientId) { // eslint-disable-line no-unused-vars
1447
+ return true;
1448
+ },
1449
+
1450
+ /**
1451
+ * features.clientIdMetadataDocument.allowClient
1452
+ *
1453
+ * description: Specifies a helper function that shall be invoked every time a client
1454
+ * resolved from a metadata document is about to be used, including when served from
1455
+ * cache. This function enables per-request evaluation of trust and authorization
1456
+ * policies for metadata-document-resolved clients. Return `true` to allow the client,
1457
+ * or `false` to reject it.
1458
+ */
1459
+ async allowClient(ctx, client) {
1460
+ return true;
1461
+ },
1462
+
1463
+ /**
1464
+ * features.clientIdMetadataDocument.cacheDuration
1465
+ *
1466
+ * description: Specifies the minimum and maximum cache duration bounds (in seconds)
1467
+ * applied to HTTP cache headers when caching fetched client metadata documents.
1468
+ * Cache-Control and Expires response headers are respected within these bounds.
1469
+ */
1470
+ cacheDuration: { min: 30, max: 86400 },
1471
+
1472
+ },
1473
+
1474
+ /*
1475
+ * features.claimsParameter
1476
+ *
1477
+ * title: [OIDC Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#ClaimsParameter) - Requesting Claims using the "claims" Request Parameter
1478
+ *
1479
+ * description: Specifies whether the `claims` request parameter shall be enabled for
1480
+ * authorization requests.
1481
+ * When enabled, the authorization server shall accept and process
1482
+ * the `claims` parameter to enable fine-grained control over which claims are
1483
+ * returned in ID Tokens and from the UserInfo Endpoint.
1484
+ *
1485
+ */
1486
+ claimsParameter: {
1487
+ enabled: false,
1488
+
1489
+ /*
1490
+ * features.claimsParameter.assertClaimsParameter
1491
+ *
1492
+ * description: Specifies a helper function that shall be invoked to perform additional
1493
+ * validation of the `claims` parameter. This function enables enforcement of
1494
+ * deployment-specific policies, security constraints, or extended claim validation
1495
+ * logic according to authorization server requirements.
1496
+ *
1497
+ * The function may throw errors to reject non-compliant claims requests or return
1498
+ * successfully to indicate acceptance of the claims parameter content.
1499
+ */
1500
+ assertClaimsParameter,
1501
+ },
1502
+
1503
+ /*
1504
+ * features.clientCredentials
1505
+ *
1506
+ * title: [RFC6749](https://www.rfc-editor.org/rfc/rfc6749.html#section-1.3.4) - Client Credentials
1507
+ *
1508
+ * description: Specifies whether the Client Credentials grant type shall be enabled.
1509
+ * When enabled, the authorization server
1510
+ * shall accept `grant_type=client_credentials` requests at the token endpoint,
1511
+ * allowing clients to obtain access tokens.
1512
+ */
1513
+ clientCredentials: { enabled: false },
1514
+
1515
+ /*
1516
+ * features.deviceFlow
1517
+ *
1518
+ * title: [RFC8628](https://www.rfc-editor.org/rfc/rfc8628.html) - OAuth 2.0 Device Authorization Grant (Device Flow)
1519
+ *
1520
+ * description: Specifies whether the OAuth 2.0 Device Authorization Grant shall be enabled.
1521
+ * When enabled, the authorization server shall support the device
1522
+ * authorization flow, enabling OAuth clients on input-constrained devices to obtain
1523
+ * user authorization by directing the user to perform the authorization flow on a
1524
+ * secondary device with richer input and display capabilities.
1525
+ */
1526
+ deviceFlow: {
1527
+ enabled: false,
1528
+
1529
+ /*
1530
+ * features.deviceFlow.charset
1531
+ *
1532
+ * description: Specifies the character set used for generating user codes in the device
1533
+ * authorization flow. This configuration determines the alphabet from which user codes
1534
+ * are constructed. Supported values include:
1535
+ * - `base-20` - Uses characters BCDFGHJKLMNPQRSTVWXZ (excludes easily confused characters)
1536
+ * - `digits` - Uses characters 0123456789 (numeric only)
1537
+ */
1538
+ charset: 'base-20',
1539
+
1540
+ /*
1541
+ * features.deviceFlow.mask
1542
+ *
1543
+ * description: Specifies the template pattern used for generating user codes in the device
1544
+ * authorization flow. The authorization server shall replace `*` characters with random
1545
+ * characters from the configured charset, while `-` (dash) and ` ` (space) characters
1546
+ * may be included for enhanced readability. Refer to RFC 8628
1547
+ * for guidance on minimal recommended entropy requirements for user code generation.
1548
+ */
1549
+ mask: '****-****',
1550
+
1551
+ /*
1552
+ * features.deviceFlow.deviceInfo
1553
+ *
1554
+ * description: Specifies a helper function that shall be invoked to extract device-specific
1555
+ * information from device authorization endpoint requests. The extracted information
1556
+ * becomes available during the end-user confirmation screen to assist users in verifying
1557
+ * that the authorization request originated from a device in their possession. This
1558
+ * enhances security by enabling users to confirm device identity before granting authorization.
1559
+ */
1560
+ deviceInfo,
1561
+ /*
1562
+ * features.deviceFlow.userCodeInputSource
1563
+ *
1564
+ * description: Specifies the HTML source that shall be rendered when the device flow
1565
+ * feature displays a user code input prompt to the User-Agent. This template is
1566
+ * presented during the device authorization flow when the authorization server
1567
+ * requires the end-user to enter a device-generated user code for verification.
1568
+ */
1569
+ userCodeInputSource,
1570
+
1571
+ /*
1572
+ * features.deviceFlow.userCodeConfirmSource
1573
+ *
1574
+ * description: Specifies the HTML source that shall be rendered when the device flow
1575
+ * feature displays a confirmation prompt to the User-Agent. This template is
1576
+ * presented after successful user code validation to confirm the authorization
1577
+ * request before proceeding with the device authorization flow.
1578
+ */
1579
+ userCodeConfirmSource,
1580
+
1581
+ /*
1582
+ * features.deviceFlow.successSource
1583
+ *
1584
+ * description: Specifies the HTML source that shall be rendered when the device flow
1585
+ * feature displays a success page to the User-Agent. This template is presented
1586
+ * upon successful completion of the device authorization flow to inform the
1587
+ * end-user that authorization has been granted to the requesting device.
1588
+ */
1589
+ successSource,
1590
+ },
1591
+
1592
+ /*
1593
+ * features.encryption
1594
+ *
1595
+ * title: JWE Encryption
1596
+ *
1597
+ * description: Specifies whether encryption capabilities shall be enabled.
1598
+ * When enabled, the authorization server shall support accepting and issuing encrypted
1599
+ * tokens involved in its other enabled capabilities.
1600
+ */
1601
+ encryption: { enabled: false },
1602
+
1603
+ /*
1604
+ * features.fapi
1605
+ *
1606
+ * title: FAPI Security Profiles
1607
+ *
1608
+ * description: Specifies whether FAPI Security Profile capabilities shall be
1609
+ * enabled. When enabled, the authorization server shall implement additional security
1610
+ * behaviors defined in FAPI specifications that cannot be achieved through other
1611
+ * configuration options.
1612
+ */
1613
+ fapi: {
1614
+ enabled: false,
1615
+ /*
1616
+ * features.fapi.profile
1617
+ *
1618
+ * description: Specifies the FAPI profile version that shall be applied for security
1619
+ * policy enforcement. The authorization server shall implement the behaviors defined
1620
+ * in the selected profile specification. Supported values include:
1621
+ *
1622
+ * - '2.0' - The authorization server shall implement behaviors from [FAPI 2.0 Security Profile](https://openid.net/specs/fapi-security-profile-2_0-final.html)
1623
+ * - '1.0 Final' - The authorization server shall implement behaviors from [FAPI 1.0 Security Profile - Part 2: Advanced](https://openid.net/specs/openid-financial-api-part-2-1_0-final.html)
1624
+ * - Function - A function that shall be invoked with arguments `(ctx, client)` to determine
1625
+ * the profile contextually. The function shall return one of the supported profile values
1626
+ * or undefined when FAPI behaviors should be ignored for the current request context.
1627
+ */
1628
+ profile: undefined,
1629
+ },
1630
+
1631
+ /*
1632
+ * features.rpInitiatedLogout
1633
+ *
1634
+ * title: [OIDC RP-Initiated Logout 1.0](https://openid.net/specs/openid-connect-rpinitiated-1_0-final.html)
1635
+ *
1636
+ * description: Specifies whether RP-Initiated Logout capabilities shall be enabled. When
1637
+ * enabled, the authorization server shall support logout requests initiated by relying
1638
+ * parties, allowing clients to request termination of end-user sessions.
1639
+ */
1640
+ rpInitiatedLogout: {
1641
+ enabled: true,
1642
+
1643
+ /*
1644
+ * features.rpInitiatedLogout.postLogoutSuccessSource
1645
+ *
1646
+ * description: Specifies the HTML source that shall be rendered when an RP-Initiated
1647
+ * Logout request concludes successfully but no `post_logout_redirect_uri` was provided
1648
+ * by the requesting client. This template shall be presented to inform the end-user
1649
+ * that the logout operation has completed successfully and provide appropriate
1650
+ * post-logout guidance.
1651
+ */
1652
+ postLogoutSuccessSource,
1653
+
1654
+ /*
1655
+ * features.rpInitiatedLogout.logoutSource
1656
+ *
1657
+ * description: Specifies the HTML source that shall be rendered when RP-Initiated Logout
1658
+ * displays a confirmation prompt to the User-Agent. This template shall be presented
1659
+ * to request explicit end-user confirmation before proceeding with the logout operation,
1660
+ * ensuring user awareness and consent for session termination.
1661
+ */
1662
+ logoutSource,
1663
+ },
1664
+
1665
+ /*
1666
+ * features.introspection
1667
+ *
1668
+ * title: [RFC7662](https://www.rfc-editor.org/rfc/rfc7662.html) - OAuth 2.0 Token Introspection
1669
+ *
1670
+ * description: Specifies whether OAuth 2.0 Token Introspection capabilities shall be enabled.
1671
+ * When enabled, the authorization server shall expose a token introspection endpoint that
1672
+ * allows authorized clients and resource servers to query the metadata and status of
1673
+ * the following token types:
1674
+ * - Opaque access tokens
1675
+ * - Refresh tokens
1676
+ *
1677
+ */
1678
+ introspection: {
1679
+ enabled: false,
1680
+
1681
+ /*
1682
+ * features.introspection.allowedPolicy
1683
+ *
1684
+ * description: Specifies a helper function that shall be invoked to determine whether
1685
+ * the requesting client or resource server is authorized to introspect the specified
1686
+ * token. This function enables enforcement of fine-grained access control policies
1687
+ * for token introspection operations according to authorization server security requirements.
1688
+ */
1689
+ allowedPolicy: introspectionAllowedPolicy,
1690
+ },
1691
+
1692
+ /*
1693
+ * features.jwtIntrospection
1694
+ *
1695
+ * title: [RFC9701](https://www.rfc-editor.org/rfc/rfc9701.html) - JWT Response for OAuth Token Introspection
1696
+ *
1697
+ * description: Specifies whether JWT-formatted token introspection responses shall be enabled.
1698
+ * When enabled, the authorization server shall support issuing introspection responses
1699
+ * as JSON Web Tokens, providing enhanced security and integrity protection for token
1700
+ * metadata transmission between authorized parties.
1701
+ */
1702
+ jwtIntrospection: { enabled: false },
1703
+
1704
+ /*
1705
+ * features.jwtResponseModes
1706
+ *
1707
+ * title: [JWT Secured Authorization Response Mode (JARM)](https://openid.net/specs/oauth-v2-jarm-errata1.html)
1708
+ *
1709
+ * description: Specifies whether JWT Secured Authorization Response Mode capabilities shall
1710
+ * be enabled. When enabled, the authorization server shall support encoding authorization
1711
+ * responses as JSON Web Tokens, providing cryptographic protection and integrity
1712
+ * assurance for authorization response parameters.
1713
+ */
1714
+ jwtResponseModes: { enabled: false },
1715
+
1716
+ /*
1717
+ * features.pushedAuthorizationRequests
1718
+ *
1719
+ * title: [RFC9126](https://www.rfc-editor.org/rfc/rfc9126.html) - OAuth 2.0 Pushed Authorization Requests (PAR)
1720
+ *
1721
+ * description: Specifies whether Pushed Authorization Request capabilities shall be enabled.
1722
+ * When enabled, the authorization server shall expose a pushed authorization request endpoint
1723
+ * that allows clients to lodge authorization request parameters at the authorization
1724
+ * server prior to redirecting end-users to the authorization endpoint,
1725
+ * enhancing security by removing the need to transmit parameters via query string parameters.
1726
+ */
1727
+ pushedAuthorizationRequests: {
1728
+ enabled: true,
1729
+
1730
+ /*
1731
+ * features.pushedAuthorizationRequests.requirePushedAuthorizationRequests
1732
+ *
1733
+ * description: Specifies whether PAR usage shall be mandatory for all authorization
1734
+ * requests as an authorization server security policy. When enabled, the authorization
1735
+ * server shall reject authorization endpoint requests that do not utilize the pushed
1736
+ * authorization request mechanism.
1737
+ */
1738
+ requirePushedAuthorizationRequests: false,
1739
+
1740
+ /*
1741
+ * features.pushedAuthorizationRequests.allowUnregisteredRedirectUris
1742
+ *
1743
+ * description: Specifies whether unregistered redirect_uri values shall be permitted
1744
+ * for authenticated clients using PAR that do not utilize a sector_identifier_uri.
1745
+ * This configuration enables dynamic redirect URI specification within the security
1746
+ * constraints of the pushed authorization request mechanism.
1747
+ */
1748
+ allowUnregisteredRedirectUris: false,
1749
+ },
1750
+
1751
+ /*
1752
+ * features.registration
1753
+ *
1754
+ * title: [OIDC Dynamic Client Registration 1.0](https://openid.net/specs/openid-connect-registration-1_0-errata2.html) and [RFC7591](https://www.rfc-editor.org/rfc/rfc7591.html) - OAuth 2.0 Dynamic Client Registration Protocol
1755
+ *
1756
+ * description: Specifies whether Dynamic Client Registration capabilities shall be enabled.
1757
+ * When enabled, the authorization server shall expose a client registration endpoint
1758
+ * that allows clients to dynamically register themselves with the authorization server
1759
+ * at runtime, enabling automated client onboarding and configuration management.
1760
+ */
1761
+ registration: {
1762
+ enabled: false,
1763
+
1764
+ /*
1765
+ * features.registration.initialAccessToken
1766
+ *
1767
+ * description: Specifies whether the registration endpoint shall require an initial
1768
+ * access token as authorization for client registration requests. This configuration
1769
+ * controls access to the dynamic registration functionality. Supported values include:
1770
+ * - `string` - The authorization server shall validate the provided bearer token
1771
+ * against this static initial access token value
1772
+ * - `boolean` - When true, the authorization server shall require adapter-backed
1773
+ * initial access tokens; when false, registration requests are processed without
1774
+ * initial access tokens.
1775
+ *
1776
+ * example: To add an adapter backed initial access token and retrieve its value.
1777
+ *
1778
+ * ```js
1779
+ * new (provider.InitialAccessToken)({}).save().then(console.log);
1780
+ * ```
1781
+ */
1782
+ initialAccessToken: false,
1783
+
1784
+ /*
1785
+ * features.registration.policies
1786
+ *
1787
+ * description: Specifies registration and registration management policies that shall be
1788
+ * applied to client metadata properties during dynamic registration operations. Policies
1789
+ * are synchronous or asynchronous functions assigned to Initial Access Tokens that
1790
+ * execute before standard client property validations. Multiple policies may be assigned
1791
+ * to an Initial Access Token, and by default, the same policies shall transfer to the
1792
+ * Registration Access Token. Policy functions may throw errors to reject registration
1793
+ * requests or modify the client properties object before validation.
1794
+ *
1795
+ * example: To define registration and registration management policies.
1796
+ *
1797
+ * To define policy functions configure `features.registration` to be an object like so:
1798
+ *
1799
+ * ```js
1800
+ * {
1801
+ * enabled: true,
1802
+ * initialAccessToken: true, // to enable adapter-backed initial access tokens
1803
+ * policies: {
1804
+ * 'my-policy': function (ctx, properties) {
1805
+ * // @param ctx - koa request context
1806
+ * // @param properties - the client properties which are about to be validated
1807
+ *
1808
+ * // example of setting a default
1809
+ * if (!('client_name' in properties)) {
1810
+ * properties.client_name = generateRandomClientName();
1811
+ * }
1812
+ *
1813
+ * // example of forcing a value
1814
+ * properties.userinfo_signed_response_alg = 'RS256';
1815
+ *
1816
+ * // example of throwing a validation error
1817
+ * if (someCondition(ctx, properties)) {
1818
+ * throw new errors.InvalidClientMetadata('validation error message');
1819
+ * }
1820
+ * },
1821
+ * 'my-policy-2': async function (ctx, properties) {},
1822
+ * },
1823
+ * }
1824
+ * ```
1825
+ *
1826
+ * An Initial Access Token with those policies being executed (one by one in that order) is
1827
+ * created like so
1828
+ * ```js
1829
+ * new (provider.InitialAccessToken)({ policies: ['my-policy', 'my-policy-2'] }).save().then(console.log);
1830
+ * ```
1831
+ *
1832
+ * recommendation: Referenced policies MUST always be present when encountered on a token; an AssertionError
1833
+ * will be thrown inside the request context if a policy is not found, resulting in a 500 Server Error.
1834
+ *
1835
+ * recommendation: The same policies will be assigned to the Registration Access Token after a successful
1836
+ * validation. If you wish to assign different policies to the Registration Access Token:
1837
+ * ```js
1838
+ * // inside your final ran policy
1839
+ * ctx.oidc.entities.RegistrationAccessToken.policies = ['update-policy'];
1840
+ * ```
1841
+ */
1842
+ policies: undefined,
1843
+
1844
+ /*
1845
+ * features.registration.idFactory
1846
+ *
1847
+ * description: Specifies a helper function that shall be invoked to generate random
1848
+ * client identifiers during dynamic client registration operations. This function
1849
+ * enables customization of client identifier generation according to authorization
1850
+ * server requirements and conventions.
1851
+ */
1852
+ idFactory,
1853
+
1854
+ /*
1855
+ * features.registration.secretFactory
1856
+ *
1857
+ * description: Specifies a helper function that shall be invoked to generate random
1858
+ * client secrets during dynamic client registration operations. This function
1859
+ * enables customization of client secret generation according to authorization
1860
+ * server security requirements and entropy specifications.
1861
+ */
1862
+ secretFactory,
1863
+
1864
+ /*
1865
+ * features.registration.issueRegistrationAccessToken
1866
+ *
1867
+ * description: Specifies whether a registration access token shall be issued upon
1868
+ * successful client registration. This configuration determines if clients receive
1869
+ * tokens for subsequent registration management operations. Supported values include:
1870
+ * - `true` - Registration access tokens shall be issued for all successful registrations
1871
+ * - `false` - Registration access tokens shall not be issued
1872
+ * - Function - A function that shall be invoked to dynamically determine token issuance
1873
+ * based on request context and authorization server policy
1874
+ *
1875
+ * example: To determine if a registration access token should be issued dynamically.
1876
+ *
1877
+ * ```js
1878
+ * // @param ctx - koa request context
1879
+ * async issueRegistrationAccessToken(ctx) {
1880
+ * return policyImplementation(ctx)
1881
+ * }
1882
+ * ```
1883
+ */
1884
+ issueRegistrationAccessToken: true,
1885
+ },
1886
+
1887
+ /*
1888
+ * features.registrationManagement
1889
+ *
1890
+ * title: [RFC7592](https://www.rfc-editor.org/rfc/rfc7592.html) - OAuth 2.0 Dynamic Client Registration Management Protocol
1891
+ *
1892
+ * description: Specifies whether Dynamic Client Registration Management capabilities shall be enabled.
1893
+ * When enabled, the authorization server shall expose Update and Delete operations as defined in RFC 7592,
1894
+ * allowing clients to modify or remove their registration entries using Registration Access Tokens
1895
+ * for client lifecycle management operations.
1896
+ */
1897
+ registrationManagement: {
1898
+ enabled: false,
1899
+
1900
+ /*
1901
+ * features.registrationManagement.rotateRegistrationAccessToken
1902
+ *
1903
+ * description: Specifies whether registration access token rotation shall be enabled as a security
1904
+ * policy for client registration management operations. When token rotation is active, the
1905
+ * authorization server shall discard the current Registration Access Token upon successful
1906
+ * update operations and issue a new token, returning it to the client with the Registration
1907
+ * Update Response.
1908
+ *
1909
+ * Supported values include:
1910
+ * - `false` - Registration access tokens shall not be rotated and remain valid after use
1911
+ * - `true` - Registration access tokens shall be rotated when used for management operations
1912
+ * - Function - A function that shall be invoked to dynamically determine whether rotation
1913
+ * should occur based on request context and authorization server policy
1914
+ *
1915
+ * example: Dynamic token rotation policy implementation.
1916
+ *
1917
+ * ```js
1918
+ * {
1919
+ * features: {
1920
+ * registrationManagement: {
1921
+ * enabled: true,
1922
+ * async rotateRegistrationAccessToken(ctx) {
1923
+ * // return tokenRecentlyRotated(ctx.oidc.entities.RegistrationAccessToken);
1924
+ * // or
1925
+ * // return customClientBasedPolicy(ctx.oidc.entities.Client);
1926
+ * }
1927
+ * }
1928
+ * }
1929
+ * }
1930
+ * ```
1931
+ */
1932
+ rotateRegistrationAccessToken: true,
1933
+ },
1934
+
1935
+ /*
1936
+ * features.richAuthorizationRequests
1937
+ *
1938
+ * title: [RFC9396](https://www.rfc-editor.org/rfc/rfc9396.html) - OAuth 2.0 Rich Authorization Requests
1939
+ *
1940
+ * description: Specifies whether Rich Authorization Request capabilities shall be enabled.
1941
+ * When enabled, the authorization server shall support the `authorization_details` parameter
1942
+ * at the authorization and token endpoints to enable issuing Access Tokens with fine-grained
1943
+ * authorization data and enhanced authorization scope control.
1944
+ */
1945
+ richAuthorizationRequests: {
1946
+ enabled: false,
1947
+ ack: undefined,
1948
+ /*
1949
+ * features.richAuthorizationRequests.types
1950
+ *
1951
+ * description: Specifies the authorization details type identifiers that shall be supported
1952
+ * by the authorization server. Each type identifier MUST have an associated validation
1953
+ * function that defines the required structure and constraints for authorization details
1954
+ * of that specific type according to authorization server policy.
1955
+ *
1956
+ * example: Authorization details type validation for tax data access.
1957
+ *
1958
+ * ```js
1959
+ * import { z } from 'zod'
1960
+ *
1961
+ * const TaxData = z
1962
+ * .object({
1963
+ * duration_of_access: z.number().int().positive(),
1964
+ * locations: z
1965
+ * .array(
1966
+ * z.literal('https://taxservice.govehub.no.example.com'),
1967
+ * )
1968
+ * .length(1),
1969
+ * actions: z
1970
+ * .array(z.literal('read_tax_declaration'))
1971
+ * .length(1),
1972
+ * periods: z
1973
+ * .array(
1974
+ * z.coerce
1975
+ * .number()
1976
+ * .max(new Date().getFullYear() - 1)
1977
+ * .min(1997),
1978
+ * )
1979
+ * .min(1),
1980
+ * tax_payer_id: z.string().min(1),
1981
+ * })
1982
+ * .strict()
1983
+ *
1984
+ * const configuration = {
1985
+ * features: {
1986
+ * richAuthorizationRequests: {
1987
+ * enabled: true,
1988
+ * // ...
1989
+ * types: {
1990
+ * tax_data: {
1991
+ * validate(ctx, detail, client) {
1992
+ * const { success: valid, error } =
1993
+ * TaxData.safeParse(detail)
1994
+ * if (!valid) {
1995
+ * throw new InvalidAuthorizationDetails()
1996
+ * }
1997
+ * },
1998
+ * },
1999
+ * },
2000
+ * },
2001
+ * },
2002
+ * }
2003
+ * ```
2004
+ */
2005
+ types: {},
2006
+ /*
2007
+ * features.richAuthorizationRequests.rarForAuthorizationCode
2008
+ *
2009
+ * description: Specifies a helper function that shall be invoked to transform the requested
2010
+ * and granted Rich Authorization Request details for storage in the authorization code.
2011
+ * This function enables filtering and processing of authorization details according to
2012
+ * authorization server policy before code persistence. The function shall return an
2013
+ * array of authorization details or undefined.
2014
+ */
2015
+ rarForAuthorizationCode(ctx) {
2016
+ // decision points:
2017
+ // - ctx.oidc.client
2018
+ // - ctx.oidc.resourceServers
2019
+ // - ctx.oidc.params.authorization_details (unparsed authorization_details from the authorization request)
2020
+ // - ctx.oidc.grant.rar (authorization_details granted)
2021
+ mustChange('features.richAuthorizationRequests.rarForAuthorizationCode', 'transform the requested and granted RAR details to be passed in the authorization code');
2022
+ throw new Error(
2023
+ 'features.richAuthorizationRequests.rarForAuthorizationCode not implemented',
2024
+ );
2025
+ },
2026
+ /*
2027
+ * features.richAuthorizationRequests.rarForCodeResponse
2028
+ *
2029
+ * description: Specifies a helper function that shall be invoked to transform the requested
2030
+ * and granted Rich Authorization Request details for inclusion in the Access Token Response
2031
+ * as authorization_details and assignment to the issued Access Token during the authorization code grant.
2032
+ * This function enables
2033
+ * resource-specific filtering and transformation of authorization details according to
2034
+ * token endpoint policy. The function shall return an array of authorization details or undefined.
2035
+ */
2036
+ rarForCodeResponse(ctx, resourceServer) {
2037
+ // decision points:
2038
+ // - ctx.oidc.client
2039
+ // - resourceServer
2040
+ // - ctx.oidc.authorizationCode.rar (previously returned from rarForAuthorizationCode)
2041
+ // - ctx.oidc.params.authorization_details (unparsed authorization_details from the body params in the Access Token Request)
2042
+ // - ctx.oidc.grant.rar (authorization_details granted)
2043
+ mustChange('features.richAuthorizationRequests.rarForCodeResponse', 'transform the requested and granted RAR details to be returned in the Access Token Response as authorization_details as well as assigned to the issued Access Token');
2044
+ throw new Error(
2045
+ 'features.richAuthorizationRequests.rarForCodeResponse not implemented',
2046
+ );
2047
+ },
2048
+ /*
2049
+ * features.richAuthorizationRequests.rarForBackchannelResponse
2050
+ *
2051
+ * description: Specifies a helper function that shall be invoked to transform the requested
2052
+ * and granted Rich Authorization Request details for inclusion in the Access Token Response
2053
+ * as authorization_details and assignment to the issued Access Token during the ciba grant.
2054
+ * This function enables
2055
+ * resource-specific filtering and transformation of authorization details according to
2056
+ * token endpoint policy. The function shall return an array of authorization details or undefined.
2057
+ */
2058
+ rarForBackchannelResponse(ctx, resourceServer) {
2059
+ // decision points:
2060
+ // - ctx.oidc.client
2061
+ // - resourceServer
2062
+ // - ctx.oidc.entities.BackchannelAuthenticationRequest.rar (the rar applied during await provider.backchannelResult())
2063
+ // - ctx.oidc.entities.BackchannelAuthenticationRequest.params.authorization_details (the original backchannel authentication request authorization_details object)
2064
+ // - ctx.oidc.params.authorization_details (unparsed authorization_details from the body params in the Access Token Request)
2065
+ // - ctx.oidc.grant.rar (authorization_details granted)
2066
+ mustChange('features.richAuthorizationRequests.rarForBackchannelResponse', 'transform the requested and granted RAR details to be returned in the Access Token Response as authorization_details as well as assigned to the issued Access Token');
2067
+ throw new Error(
2068
+ 'features.richAuthorizationRequests.rarForBackchannelResponse not implemented',
2069
+ );
2070
+ },
2071
+ /*
2072
+ * features.richAuthorizationRequests.rarForRefreshTokenResponse
2073
+ *
2074
+ * description: Specifies a helper function that shall be invoked to transform the requested
2075
+ * and granted Rich Authorization Request details for inclusion in the Access Token Response
2076
+ * during refresh token exchanges as authorization_details and assignment to the newly issued
2077
+ * Access Token. This function enables resource-specific processing of previously granted
2078
+ * authorization details according to refresh token policy. The function shall return an
2079
+ * array of authorization details or undefined.
2080
+ */
2081
+ rarForRefreshTokenResponse(ctx, resourceServer) {
2082
+ // decision points:
2083
+ // - ctx.oidc.client
2084
+ // - resourceServer
2085
+ // - ctx.oidc.refreshToken.rar (previously returned from rarForAuthorizationCode and later assigned to the refresh token)
2086
+ // - ctx.oidc.params.authorization_details (unparsed authorization_details from the body params in the Access Token Request)
2087
+ // - ctx.oidc.grant.rar
2088
+ mustChange('features.richAuthorizationRequests.rarForRefreshTokenResponse', 'transform the requested and granted RAR details to be returned in the Access Token Response as authorization_details as well as assigned to the issued Access Token');
2089
+ throw new Error(
2090
+ 'features.richAuthorizationRequests.rarForRefreshTokenResponse not implemented',
2091
+ );
2092
+ },
2093
+ /*
2094
+ * features.richAuthorizationRequests.rarForIntrospectionResponse
2095
+ *
2096
+ * description: Specifies a helper function that shall be invoked to transform the token's
2097
+ * stored Rich Authorization Request details for inclusion in the Token Introspection Response.
2098
+ * This function enables filtering and processing of authorization details according to
2099
+ * introspection endpoint policy and requesting party authorization. The function shall
2100
+ * return an array of authorization details or undefined.
2101
+ */
2102
+ rarForIntrospectionResponse(ctx, token) {
2103
+ // decision points:
2104
+ // - ctx.oidc.client
2105
+ // - token.kind
2106
+ // - token.rar
2107
+ // - ctx.oidc.grant.rar
2108
+ mustChange('features.richAuthorizationRequests.rarForIntrospectionResponse', 'transform the token\'s stored RAR details to be returned in the Introspection Response');
2109
+ throw new Error(
2110
+ 'features.richAuthorizationRequests.rarForIntrospectionResponse not implemented',
2111
+ );
2112
+ },
2113
+ },
2114
+
2115
+ /*
2116
+ * features.resourceIndicators
2117
+ *
2118
+ * @important
2119
+ *
2120
+ * title: [RFC8707](https://www.rfc-editor.org/rfc/rfc8707.html) - Resource Indicators for OAuth 2.0
2121
+ *
2122
+ * description: Specifies whether Resource Indicator capabilities shall be enabled. When
2123
+ * enabled, the authorization server shall support the `resource` parameter at the
2124
+ * authorization and token endpoints to enable issuing Access Tokens for specific
2125
+ * Resource Servers (APIs) with enhanced audience control and scope management.
2126
+ *
2127
+ * The authorization server implements the following resource indicator processing rules:
2128
+ * - Multiple resource parameters may be present during Authorization Code Flow,
2129
+ * Device Authorization Grant, and Backchannel Authentication Requests,
2130
+ * but only a single audience for an Access Token is permitted.
2131
+ * - Authorization and Authentication Requests that result in an Access Token being issued by the
2132
+ * Authorization Endpoint MUST only contain a single resource (or one MUST be resolved using the
2133
+ * `defaultResource` helper).
2134
+ * - Client Credentials grant MUST only contain a single resource parameter.
2135
+ * - During Authorization Code / Refresh Token / Device Code / Backchannel Authentication Request
2136
+ * exchanges, if the exchanged code/token does not include the `'openid'` scope and only has a single
2137
+ * resource then the resource parameter may be omitted - an Access Token for the single resource is
2138
+ * returned.
2139
+ * - During Authorization Code / Refresh Token / Device Code / Backchannel Authentication Request
2140
+ * exchanges, if the exchanged code/token does not include the `'openid'` scope and has multiple
2141
+ * resources then the resource parameter MUST be provided (or one MUST be resolved using the
2142
+ * `defaultResource` helper).
2143
+ * An Access Token for the provided/resolved resource is returned.
2144
+ * - (with userinfo endpoint enabled and useGrantedResource helper returning falsy)
2145
+ * During Authorization Code / Refresh Token / Device Code
2146
+ * exchanges, if the exchanged code/token includes the `'openid'` scope and no resource
2147
+ * parameter is present - an Access Token for the UserInfo Endpoint is returned.
2148
+ * - (with userinfo endpoint enabled and useGrantedResource helper returning truthy)
2149
+ * During Authorization Code / Refresh Token / Device Code
2150
+ * exchanges, even if the exchanged code/token includes the `'openid'` scope and only has a single
2151
+ * resource then the resource parameter may be omitted - an Access Token for the single resource
2152
+ * is returned.
2153
+ * - (with userinfo endpoint disabled) During Authorization Code / Refresh Token / Device Code
2154
+ * exchanges, if the exchanged code/token includes the `'openid'` scope and only has a single
2155
+ * resource then the resource parameter may be omitted - an Access Token for the single resource
2156
+ * is returned.
2157
+ * - Issued Access Tokens shall always only contain scopes that are defined on the respective Resource
2158
+ * Server (returned from `features.resourceIndicators.getResourceServerInfo`).
2159
+ */
2160
+ resourceIndicators: {
2161
+ enabled: true,
2162
+
2163
+ /*
2164
+ * features.resourceIndicators.defaultResource
2165
+ *
2166
+ * description: Specifies a helper function that shall be invoked to determine the default
2167
+ * resource indicator for a request when none is provided by the client during the
2168
+ * authorization request or when multiple resources are provided/resolved and only a
2169
+ * single one is required during an Access Token Request. This function enables
2170
+ * authorization server policy-based resource selection according to deployment requirements.
2171
+ */
2172
+ defaultResource,
2173
+
2174
+ /*
2175
+ * features.resourceIndicators.useGrantedResource
2176
+ *
2177
+ * description: Specifies a helper function that shall be invoked to determine whether
2178
+ * an already granted resource indicator should be used without being explicitly
2179
+ * requested by the client during the Token Endpoint request. This function enables
2180
+ * flexible resource selection policies for token issuance operations.
2181
+ *
2182
+ * recommendation: Use `return true` when it's allowed for a client to skip providing the "resource"
2183
+ * parameter at the Token Endpoint.
2184
+ * recommendation: Use `return false` (default) when it's required for a client to explicitly
2185
+ * provide a "resource" parameter at the Token Endpoint or when other indication
2186
+ * dictates an Access Token for the UserInfo Endpoint should be returned.
2187
+ */
2188
+ useGrantedResource,
2189
+
2190
+ /*
2191
+ * features.resourceIndicators.getResourceServerInfo
2192
+ *
2193
+ * description: Specifies a helper function that shall be invoked to load information about
2194
+ * a Resource Server (API) and determine whether the client is authorized to request
2195
+ * scopes for that particular resource. This function enables resource-specific scope
2196
+ * validation and Access Token configuration according to authorization server policy.
2197
+ *
2198
+ * recommendation: Only allow client's pre-registered resource values. To pre-register these
2199
+ * you shall use the `extraClientMetadata` configuration option to define a custom metadata
2200
+ * and use that to implement your policy using this function.
2201
+ *
2202
+ * example: Resource Server Definition.
2203
+ *
2204
+ * ```js
2205
+ * {
2206
+ * // REQUIRED
2207
+ * // available scope values (space-delimited string)
2208
+ * scope: string,
2209
+ *
2210
+ * // OPTIONAL
2211
+ * // "aud" (Audience) value to use
2212
+ * // Default is the resource indicator value will be used as token audience
2213
+ * audience?: string,
2214
+ *
2215
+ * // OPTIONAL
2216
+ * // Issued Token TTL
2217
+ * // Default is - see `ttl` configuration
2218
+ * accessTokenTTL?: number,
2219
+ *
2220
+ * // Issued Token Format
2221
+ * // Default is - opaque
2222
+ * accessTokenFormat?: 'opaque' | 'jwt',
2223
+ *
2224
+ * // JWT Access Token Format (when accessTokenFormat is 'jwt')
2225
+ * // Default is `{ sign: { alg: 'RS256' }, encrypt: false }`
2226
+ * // Tokens may be signed, signed and then encrypted, or just encrypted JWTs.
2227
+ * jwt?: {
2228
+ * // Tokens will be signed
2229
+ * sign?:
2230
+ * | {
2231
+ * alg?: string, // 'PS256' | 'PS384' | 'PS512' | 'ES256' | 'ES384' | 'ES512' | 'Ed25519' | 'RS256' | 'RS384' | 'RS512' | 'EdDSA' | 'ML-DSA-44' | 'ML-DSA-65' | 'ML-DSA-87'
2232
+ * kid?: string, // OPTIONAL `kid` to aid in signing key selection
2233
+ * }
2234
+ * | {
2235
+ * alg: string, // 'HS256' | 'HS384' | 'HS512'
2236
+ * key: CryptoKey | KeyObject | Buffer, // shared symmetric secret to sign the JWT token with
2237
+ * kid?: string, // OPTIONAL `kid` JOSE Header Parameter to put in the token's JWS Header
2238
+ * },
2239
+ * // Tokens will be encrypted
2240
+ * encrypt?: {
2241
+ * alg: string, // 'dir' | 'RSA-OAEP' | 'RSA-OAEP-256' | 'RSA-OAEP-384' | 'RSA-OAEP-512' | 'ECDH-ES' | 'ECDH-ES+A128KW' | 'ECDH-ES+A192KW' | 'ECDH-ES+A256KW' | 'A128KW' | 'A192KW' | 'A256KW' | 'A128GCMKW' | 'A192GCMKW' | 'A256GCMKW'
2242
+ * enc: string, // 'A128CBC-HS256' | 'A128GCM' | 'A192CBC-HS384' | 'A192GCM' | 'A256CBC-HS512' | 'A256GCM'
2243
+ * key: CryptoKey | KeyObject | Buffer, // public key or shared symmetric secret to encrypt the JWT token with
2244
+ * kid?: string, // OPTIONAL `kid` JOSE Header Parameter to put in the token's JWE Header
2245
+ * }
2246
+ * }
2247
+ * }
2248
+ * ```
2249
+ *
2250
+ * example: Resource Server (API) with two scopes, an expected audience value, an Access Token TTL and a JWT Access Token Format.
2251
+ *
2252
+ * ```js
2253
+ * {
2254
+ * scope: 'api:read api:write',
2255
+ * audience: 'resource-server-audience-value',
2256
+ * accessTokenTTL: 2 * 60 * 60, // 2 hours
2257
+ * accessTokenFormat: 'jwt',
2258
+ * jwt: {
2259
+ * sign: { alg: 'ES256' },
2260
+ * },
2261
+ * }
2262
+ * ```
2263
+ *
2264
+ * example: Resource Server (API) with two scopes and a symmetrically encrypted JWT Access Token Format.
2265
+ *
2266
+ * ```js
2267
+ * {
2268
+ * scope: 'api:read api:write',
2269
+ * accessTokenFormat: 'jwt',
2270
+ * jwt: {
2271
+ * sign: false,
2272
+ * encrypt: {
2273
+ * alg: 'dir',
2274
+ * enc: 'A128CBC-HS256',
2275
+ * key: Buffer.from('f40dd9591646bebcb9c32aed02f5e610c2d15e1d38cde0c1fe14a55cf6bfe2d9', 'hex')
2276
+ * },
2277
+ * }
2278
+ * }
2279
+ * ```
2280
+ */
2281
+ getResourceServerInfo,
2282
+ },
2283
+
2284
+ /*
2285
+ * features.requestObjects
2286
+ *
2287
+ * title: [OIDC Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#RequestObject) and [RFC9101](https://www.rfc-editor.org/rfc/rfc9101.html#name-passing-a-request-object-by) - Passing a Request Object by Value (JAR)
2288
+ *
2289
+ * description: Specifies whether Request Object capabilities shall be enabled. When enabled,
2290
+ * the authorization server shall support the use and validation of the `request` parameter
2291
+ * for conveying authorization request parameters as JSON Web Tokens, providing enhanced
2292
+ * security and integrity protection for authorization requests.
2293
+ */
2294
+ requestObjects: {
2295
+ enabled: false,
2296
+
2297
+ /*
2298
+ * features.requestObjects.requireSignedRequestObject
2299
+ *
2300
+ * description: Specifies whether the use of signed request objects shall be mandatory for
2301
+ * all authorization requests as an authorization server security policy. When enabled,
2302
+ * the authorization server shall reject authorization requests that do not include a
2303
+ * signed Request Object JWT.
2304
+ */
2305
+ requireSignedRequestObject: false,
2306
+
2307
+ /*
2308
+ * features.requestObjects.assertJwtClaimsAndHeader
2309
+ *
2310
+ * description: Specifies a helper function that shall be invoked to perform additional
2311
+ * validation of the Request Object JWT Claims Set and Header beyond the standard
2312
+ * JAR specification requirements. This function enables enforcement of deployment-specific
2313
+ * policies, security constraints, or extended validation logic according to authorization
2314
+ * server requirements.
2315
+ */
2316
+ assertJwtClaimsAndHeader,
2317
+ },
2318
+
2319
+ /*
2320
+ * features.rpMetadataChoices
2321
+ *
2322
+ * title: [OIDC Relying Party Metadata Choices 1.0 - Implementers Draft 01](https://openid.net/specs/openid-connect-rp-metadata-choices-1_0-ID1.html)
2323
+ *
2324
+ * description: Specifies whether Relying Party Metadata Choices capabilities shall be enabled.
2325
+ * When enabled, the authorization server shall support the following multi-valued input
2326
+ * parameters metadata from the Relying Party Metadata Choices draft, provided that their
2327
+ * underlying feature is also enabled:
2328
+ *
2329
+ * - subject_types_supported
2330
+ * - id_token_signing_alg_values_supported
2331
+ * - id_token_encryption_alg_values_supported
2332
+ * - id_token_encryption_enc_values_supported
2333
+ * - userinfo_signing_alg_values_supported
2334
+ * - userinfo_encryption_alg_values_supported
2335
+ * - userinfo_encryption_enc_values_supported
2336
+ * - request_object_signing_alg_values_supported
2337
+ * - request_object_encryption_alg_values_supported
2338
+ * - request_object_encryption_enc_values_supported
2339
+ * - token_endpoint_auth_methods_supported
2340
+ * - token_endpoint_auth_signing_alg_values_supported
2341
+ * - introspection_signing_alg_values_supported
2342
+ * - introspection_encryption_alg_values_supported
2343
+ * - introspection_encryption_enc_values_supported
2344
+ * - authorization_signing_alg_values_supported
2345
+ * - authorization_encryption_alg_values_supported
2346
+ * - authorization_encryption_enc_values_supported
2347
+ * - backchannel_authentication_request_signing_alg_values_supported
2348
+ */
2349
+ rpMetadataChoices: { enabled: false, ack: undefined },
2350
+
2351
+ /*
2352
+ * features.revocation
2353
+ *
2354
+ * title: [RFC7009](https://www.rfc-editor.org/rfc/rfc7009.html) - OAuth 2.0 Token Revocation
2355
+ *
2356
+ * description: Specifies whether Token Revocation capabilities shall be enabled. When enabled,
2357
+ * the authorization server shall expose a token revocation endpoint that allows authorized
2358
+ * clients to notify the authorization server that a particular token
2359
+ * is no longer needed. This feature supports revocation of the following token types:
2360
+ * - Opaque access tokens
2361
+ * - Refresh tokens
2362
+ *
2363
+ */
2364
+ revocation: {
2365
+ enabled: false,
2366
+
2367
+ /*
2368
+ * features.revocation.allowedPolicy
2369
+ *
2370
+ * description: Specifies a helper function that shall be invoked to determine whether
2371
+ * the requesting client or resource server is authorized to revoke the specified token.
2372
+ * This function enables enforcement of fine-grained access control policies for token
2373
+ * revocation operations according to authorization server security requirements.
2374
+ */
2375
+ allowedPolicy: revocationAllowedPolicy,
2376
+ },
2377
+
2378
+ /*
2379
+ * features.userinfo
2380
+ *
2381
+ * title: [OIDC Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#UserInfo) - UserInfo Endpoint
2382
+ *
2383
+ * description: Specifies whether the UserInfo Endpoint shall be enabled. When enabled,
2384
+ * the authorization server shall expose a UserInfo endpoint that returns claims about
2385
+ * the authenticated end-user. Access to this endpoint requires an opaque Access Token
2386
+ * with at least `openid` scope that does not have a Resource Server audience.
2387
+ */
2388
+ userinfo: { enabled: true },
2389
+
2390
+ /*
2391
+ * features.jwtUserinfo
2392
+ *
2393
+ * title: [OIDC Core 1.0](https://openid.net/specs/openid-connect-core-1_0-errata2.html#UserInfo) - JWT UserInfo Endpoint Responses
2394
+ *
2395
+ * description: Specifies whether JWT-formatted UserInfo endpoint responses shall be enabled.
2396
+ * When enabled, the authorization server shall support returning UserInfo responses as
2397
+ * signed and/or encrypted JSON Web Tokens, providing enhanced security and integrity
2398
+ * protection for end-user claims transmission. This feature shall also enable the
2399
+ * relevant client metadata parameters for configuring JWT signing and/or encryption
2400
+ * algorithms according to client requirements.
2401
+ */
2402
+ jwtUserinfo: { enabled: false },
2403
+
2404
+ /*
2405
+ * features.webMessageResponseMode
2406
+ *
2407
+ * title: [draft-sakimura-oauth-wmrm-01](https://tools.ietf.org/html/draft-sakimura-oauth-wmrm-01) - OAuth 2.0 Web Message Response Mode
2408
+ *
2409
+ * description: Specifies whether Web Message Response Mode capabilities shall be enabled.
2410
+ * When enabled, the authorization server shall support the `web_message` response mode
2411
+ * for returning authorization responses via HTML5 Web Messaging. The implementation
2412
+ * shall support only Simple Mode operation; authorization requests containing Relay Mode
2413
+ * parameters will be rejected.
2414
+ *
2415
+ * recommendation: Although a general advice to use a `helmet` (e.g. for [express](https://www.npmjs.com/package/helmet),
2416
+ * [koa](https://www.npmjs.com/package/koa-helmet)) it is especially advised for your interaction
2417
+ * views routes if Web Message Response Mode is enabled in your deployment. You will have to experiment
2418
+ * with removal of the Cross-Origin-Embedder-Policy and Cross-Origin-Opener-Policy headers at various
2419
+ * endpoints throughout the authorization request end-user journey to finalize this feature.
2420
+ */
2421
+ webMessageResponseMode: { enabled: false, ack: undefined },
2422
+
2423
+ /*
2424
+ * features.externalSigningSupport
2425
+ *
2426
+ * title: External Signing Support
2427
+ *
2428
+ * description: Specifies whether external signing capabilities shall be enabled. When enabled,
2429
+ * the authorization server shall support the use of `ExternalSigningKey` class instances
2430
+ * in place of private JWK entries within the `jwks.keys` configuration array. This feature
2431
+ * enables Digital Signature Algorithm operations (such as PS256, ES256, or other supported
2432
+ * algorithms) to be performed by external cryptographic services, including Key Management
2433
+ * Services (KMS) and Hardware Security Modules (HSM), providing enhanced security for
2434
+ * private key material through externalized signing operations.
2435
+ *
2436
+ * see: [KMS integration with AWS Key Management Service](https://github.com/panva/node-oidc-provider/discussions/1316)
2437
+ */
2438
+ externalSigningSupport: { enabled: false, ack: undefined },
2439
+ },
2440
+
2441
+ /*
2442
+ * extraTokenClaims
2443
+ *
2444
+ * title: Additional Access Token Claims
2445
+ *
2446
+ * description: Specifies a helper function that shall be invoked to add additional claims
2447
+ * to Access Tokens during the token issuance process. For opaque Access Tokens, the
2448
+ * returned claims shall be stored in the authorization server storage under the `extra`
2449
+ * property and shall be returned by the introspection endpoint as top-level claims.
2450
+ * For JWT-formatted Access Tokens, the returned claims shall be included as top-level
2451
+ * claims within the JWT payload. Claims returned by this function will not overwrite
2452
+ * pre-existing top-level claims in the token.
2453
+ *
2454
+ * example: To add an arbitrary claim to an Access Token.
2455
+ *
2456
+ * ```js
2457
+ * {
2458
+ * async extraTokenClaims(ctx, token) {
2459
+ * return {
2460
+ * 'urn:idp:example:foo': 'bar',
2461
+ * };
2462
+ * }
2463
+ * }
2464
+ * ```
2465
+ */
2466
+ extraTokenClaims,
2467
+
2468
+ formats: {
2469
+ /*
2470
+ * formats.bitsOfOpaqueRandomness
2471
+ *
2472
+ * description: Specifies the entropy configuration for opaque token generation. The value
2473
+ * shall be an integer (or a function returning an integer) that determines the
2474
+ * cryptographic strength of generated opaque tokens. The resulting opaque token length
2475
+ * shall be calculated as `Math.ceil(i / Math.log2(n))` where `i` is the specified
2476
+ * bit count and `n` is the number of symbols in the encoding alphabet (64 characters
2477
+ * in the base64url character set used by this implementation).
2478
+ *
2479
+ * example: To have e.g. Refresh Tokens values longer than Access Tokens.
2480
+ *
2481
+ * ```js
2482
+ * function bitsOfOpaqueRandomness(ctx, token) {
2483
+ * if (token.kind === 'RefreshToken') {
2484
+ * return 384;
2485
+ * }
2486
+ *
2487
+ * return 256;
2488
+ * }
2489
+ * ```
2490
+ */
2491
+ bitsOfOpaqueRandomness: 256,
2492
+
2493
+ /*
2494
+ * formats.customizers
2495
+ *
2496
+ * description: Specifies customizer functions that shall be invoked immediately before
2497
+ * issuing structured Access Tokens to enable modification of token headers and payload
2498
+ * claims according to authorization server policy. These functions shall be called
2499
+ * during the token formatting process to apply deployment-specific customizations
2500
+ * to the token structure before signing.
2501
+ *
2502
+ * example: To add additional headers and payload claims to a `jwt` format Access Token.
2503
+ *
2504
+ * ```js
2505
+ * {
2506
+ * customizers: {
2507
+ * async jwt(ctx, token, jwt) {
2508
+ * jwt.header = { foo: 'bar' };
2509
+ * jwt.payload.foo = 'bar';
2510
+ * }
2511
+ * }
2512
+ * }
2513
+ * ```
2514
+ */
2515
+ customizers: {
2516
+ jwt: undefined,
2517
+ },
2518
+ },
2519
+
2520
+ /*
2521
+ * expiresWithSession
2522
+ *
2523
+ * title: Session-Bound Token Expiration
2524
+ *
2525
+ * description: Specifies a helper function that shall be invoked to determine whether
2526
+ * authorization codes, device codes, or authorization-endpoint-returned opaque access
2527
+ * tokens shall be bound to the end-user session. When session binding is enabled, this
2528
+ * policy shall be applied to all opaque tokens issued from the authorization code, device
2529
+ * code, or subsequent refresh token exchanges. When artifacts are session-bound, their
2530
+ * originating session will be loaded by its unique identifier every time the artifacts
2531
+ * are encountered. Session-bound artifacts shall be effectively revoked when the end-user
2532
+ * logs out, providing automatic cleanup of token state upon session termination.
2533
+ */
2534
+ expiresWithSession,
2535
+
2536
+ /*
2537
+ * issueRefreshToken
2538
+ *
2539
+ * title: Refresh Token Issuance Policy
2540
+ *
2541
+ * description: Specifies a helper function that shall be invoked to determine whether
2542
+ * a refresh token shall be issued during token endpoint operations. This function
2543
+ * enables policy-based control over refresh token issuance according to authorization
2544
+ * server requirements, client capabilities, and granted scope values.
2545
+ *
2546
+ * example: To always issue a refresh token (cont.)
2547
+ *
2548
+ * (cont.) if a client has the grant allowed and scope includes offline_access or the client is a
2549
+ * public web client doing code flow. Configure `issueRefreshToken` like so
2550
+ *
2551
+ * ```js
2552
+ * async issueRefreshToken(ctx, client, code) {
2553
+ * if (!client.grantTypeAllowed('refresh_token')) {
2554
+ * return false;
2555
+ * }
2556
+ *
2557
+ * return code.scopes.has('offline_access') || (client.applicationType === 'web' && client.clientAuthMethod === 'none');
2558
+ * }
2559
+ * ```
2560
+ */
2561
+ issueRefreshToken,
2562
+
2563
+ /*
2564
+ * jwks
2565
+ *
2566
+ * @important
2567
+ *
2568
+ * title: JSON Web Key Set (JWKS)
2569
+ *
2570
+ * description: Specifies the JSON Web Key Set that shall be used by the authorization server
2571
+ * for cryptographic signing and decryption operations. The key set MUST be provided in
2572
+ * [JWK Set format](https://www.rfc-editor.org/rfc/rfc7517.html#section-5) as defined in
2573
+ * RFC 7517. All keys within the set MUST be private keys.
2574
+ *
2575
+ * Supported key types include:
2576
+ *
2577
+ * - RSA
2578
+ * - OKP (Ed25519 and X25519 subtypes)
2579
+ * - EC (P-256, P-384, and P-521 curves)
2580
+ *
2581
+ * recommendation: Be sure to follow best practices for distributing private keying material and secrets
2582
+ * for your respective target deployment environment.
2583
+ *
2584
+ * recommendation: The following action order is recommended when rotating signing keys on a distributed
2585
+ * deployment with rolling reloads in place.
2586
+ *
2587
+ * 1. push new keys at the very end of the "keys" array in your JWKS, this means the keys will become
2588
+ * available for verification should they be encountered but not yet used for signing
2589
+ * 2. reload all your processes
2590
+ * 3. move your new key to the very front of the "keys" array in your JWKS, this means the key will be
2591
+ * used for signing after reload
2592
+ * 4. reload all your processes
2593
+ *
2594
+ * @nodefault
2595
+ *
2596
+ */
2597
+ jwks: undefined,
2598
+
2599
+ /*
2600
+ * responseTypes
2601
+ *
2602
+ * title: Supported response_type Values
2603
+ *
2604
+ * description: Specifies the response_type values supported by this authorization server.
2605
+ * In accordance with RFC 9700 (OAuth 2.0 Security Best Current Practice), the default
2606
+ * configuration excludes response types that result in access tokens being issued directly
2607
+ * by the authorization endpoint.
2608
+ *
2609
+ * example: Supported values list.
2610
+ *
2611
+ * These are values defined in [`OIDC Core 1.0`](https://openid.net/specs/openid-connect-core-1_0-errata2.html#Authentication)
2612
+ * and [OAuth 2.0 Multiple Response Type Encoding Practices](https://openid.net/specs/oauth-v2-multiple-response-types-1_0-final.html)
2613
+ * ```js
2614
+ * [
2615
+ * 'code',
2616
+ * 'id_token', 'id_token token',
2617
+ * 'code id_token', 'code token', 'code id_token token',
2618
+ * 'none',
2619
+ * ]
2620
+ * ```
2621
+ */
2622
+ responseTypes: ['code id_token', 'code', 'id_token', 'none'],
2623
+
2624
+ /*
2625
+ * pkce
2626
+ *
2627
+ * @important
2628
+ *
2629
+ * title: [RFC7636](https://www.rfc-editor.org/rfc/rfc7636.html) - Proof Key for Code Exchange (PKCE)
2630
+ *
2631
+ * description: Specifies the PKCE configuration, such as a policy check on the required use of PKCE.
2632
+ *
2633
+ * @nodefault
2634
+ */
2635
+ pkce: {
2636
+ /*
2637
+ * pkce.required
2638
+ *
2639
+ * description: Configures if and when the authorization server requires clients to use `PKCE`. This helper is called
2640
+ * whenever an authorization request lacks the code_challenge parameter.
2641
+ * Return:
2642
+ * - `false` to allow the request to continue without `PKCE`
2643
+ * - `true` to abort the request
2644
+ */
2645
+ required: pkceRequired,
2646
+ },
2647
+
2648
+ /*
2649
+ * routes
2650
+ *
2651
+ * title: Endpoint URL Paths
2652
+ *
2653
+ * description: Defines the URL path mappings for authorization server endpoints.
2654
+ * All route values are relative and shall begin with a forward slash ("/") character.
2655
+ */
2656
+ routes: {
2657
+ authorization: '/auth',
2658
+ backchannel_authentication: '/backchannel',
2659
+ code_verification: '/device',
2660
+ challenge: '/challenge',
2661
+ device_authorization: '/device/auth',
2662
+ end_session: '/session/end',
2663
+ introspection: '/token/introspection',
2664
+ jwks: '/jwks',
2665
+ pushed_authorization_request: '/request',
2666
+ registration: '/reg',
2667
+ revocation: '/token/revocation',
2668
+ token: '/token',
2669
+ userinfo: '/me',
2670
+ },
2671
+
2672
+ /*
2673
+ * scopes
2674
+ *
2675
+ * title: Supported OAuth 2.0 Scope Values
2676
+ *
2677
+ * description: Specifies additional OAuth 2.0 scope values that this authorization server
2678
+ * shall support and advertise in its discovery document. Resource Server-specific
2679
+ * scopes shall be configured via the `features.resourceIndicators` mechanism.
2680
+ */
2681
+ scopes: ['openid', 'offline_access'],
2682
+
2683
+ /*
2684
+ * subjectTypes
2685
+ *
2686
+ * title: Subject Identifier Types
2687
+ *
2688
+ * description: Specifies the array of Subject Identifier types that this authorization server
2689
+ * shall support for end-user identification purposes. When only `pairwise` is supported,
2690
+ * it shall become the default `subject_type` client metadata value. Supported identifier
2691
+ * types shall include:
2692
+ * - `public` - provides the same subject identifier value to all clients
2693
+ * - `pairwise` - provides a unique subject identifier value per client to enhance privacy
2694
+ */
2695
+ subjectTypes: ['public'],
2696
+
2697
+ /*
2698
+ * pairwiseIdentifier
2699
+ *
2700
+ * title: Pairwise Subject Identifier Generation
2701
+ *
2702
+ * description: Specifies a helper function that shall be invoked to generate pairwise subject
2703
+ * identifier values for ID Tokens and UserInfo responses, as specified in OpenID Connect
2704
+ * Core 1.0. This function enables privacy-preserving subject identifier generation that
2705
+ * provides unique identifiers per client while maintaining consistent identification for
2706
+ * the same end-user across requests to the same client.
2707
+ *
2708
+ * recommendation: Implementations should employ memoization or caching mechanisms when
2709
+ * this function may be invoked multiple times with identical arguments within a single request.
2710
+ */
2711
+ pairwiseIdentifier,
2712
+
2713
+ /*
2714
+ * clientAuthMethods
2715
+ *
2716
+ * title: Supported Client Authentication Methods
2717
+ *
2718
+ * description: Specifies the client authentication methods that this authorization server
2719
+ * shall support for authenticating clients at the token endpoint and other authenticated
2720
+ * endpoints.
2721
+ *
2722
+ * example: Supported values list.
2723
+ *
2724
+ * ```js
2725
+ * [
2726
+ * 'none',
2727
+ * 'client_secret_basic', 'client_secret_post',
2728
+ * 'client_secret_jwt', 'private_key_jwt',
2729
+ * 'tls_client_auth', 'self_signed_tls_client_auth', // these methods are only available when features.mTLS is configured
2730
+ * ]
2731
+ * ```
2732
+ */
2733
+ clientAuthMethods: [
2734
+ 'client_secret_basic',
2735
+ 'client_secret_jwt',
2736
+ 'client_secret_post',
2737
+ 'private_key_jwt',
2738
+ 'none',
2739
+ ],
2740
+
2741
+ /*
2742
+ * ttl
2743
+ *
2744
+ * @important
2745
+ *
2746
+ * title: Artifact Expirations (TTL)
2747
+ *
2748
+ * description: Specifies the Time-To-Live (TTL) values that shall be applied to various
2749
+ * artifacts within the authorization server. TTL values may be specified
2750
+ * as either a numeric value (in seconds) or a synchronous function that returns a
2751
+ * numeric value based on the current request context and authorization server policy.
2752
+ *
2753
+ * recommendation: Token TTL values should be set to the minimum duration necessary for
2754
+ * the intended use case to minimize security exposure.
2755
+ *
2756
+ * recommendation: For refresh tokens requiring extended lifetimes, consider utilizing the
2757
+ * `rotateRefreshToken` configuration option, which extends effective token lifetime through
2758
+ * rotation rather than extended initial TTL values.
2759
+ *
2760
+ * example: To resolve a ttl on runtime for each new token.
2761
+ *
2762
+ * Configure `ttl` for a given token type with a function like so, this must return a value, not a
2763
+ * Promise.
2764
+ *
2765
+ * ```js
2766
+ * {
2767
+ * ttl: {
2768
+ * AccessToken(ctx, token, client) {
2769
+ * // return a Number (in seconds) for the given token (second argument), the associated client is
2770
+ * // passed as a third argument
2771
+ * // Tip: if the values are entirely client based memoize the results
2772
+ * return resolveTTLfor(token, client);
2773
+ * },
2774
+ * },
2775
+ * }
2776
+ * ```
2777
+ */
2778
+ ttl: {
2779
+ AccessToken: AccessTokenTTL,
2780
+ AuthorizationCode: AuthorizationCodeTTL,
2781
+ BackchannelAuthenticationRequest: BackchannelAuthenticationRequestTTL,
2782
+ ClientCredentials: ClientCredentialsTTL,
2783
+ DeviceCode: DeviceCodeTTL,
2784
+ Grant: GrantTTL,
2785
+ IdToken: IdTokenTTL,
2786
+ Interaction: InteractionTTL,
2787
+ RefreshToken: RefreshTokenTTL,
2788
+ Session: SessionTTL,
2789
+ },
2790
+
2791
+ /*
2792
+ * extraClientMetadata
2793
+ *
2794
+ * title: Custom Client Metadata Properties
2795
+ *
2796
+ * description: Specifies the configuration for custom client metadata properties that shall
2797
+ * be supported by the authorization server for client registration and metadata validation purposes.
2798
+ * This configuration enables extension of standard OAuth 2.0 and OpenID Connect client
2799
+ * metadata with deployment-specific properties. Existing standards-defined properties are snakeCased on
2800
+ * a Client instance (e.g. `client.redirectUris`), while new properties defined by this
2801
+ * configuration shall be available with their names verbatim (e.g.
2802
+ * `client['urn:example:client:my-property']`).
2803
+ * @nodefault
2804
+ */
2805
+ extraClientMetadata: {
2806
+ /*
2807
+ * extraClientMetadata.properties
2808
+ *
2809
+ * description: Specifies an array of property names that clients shall be allowed to have
2810
+ * defined within their client metadata during registration and management operations.
2811
+ * Each property name listed here extends the standard client metadata schema according
2812
+ * to authorization server policy.
2813
+ */
2814
+ properties: [],
2815
+ /*
2816
+ * extraClientMetadata.validator
2817
+ *
2818
+ * description: Specifies a validator function that shall be executed in order once for every
2819
+ * property defined in `extraClientMetadata.properties`, regardless of its value or presence
2820
+ * in the client metadata passed during registration or update operations. The function MUST
2821
+ * be synchronous; async validators or functions returning Promise shall be rejected during
2822
+ * runtime. To modify the current client metadata values (for the current key or any other)
2823
+ * simply modify the passed in `metadata` argument within the validator function.
2824
+ */
2825
+ validator: extraClientMetadataValidator,
2826
+ },
2827
+
2828
+ /*
2829
+ * renderError
2830
+ *
2831
+ * title: Error Response Rendering
2832
+ *
2833
+ * description: Specifies a function that shall be invoked to present error responses to the
2834
+ * User-Agent during authorization server operations. This function enables customization
2835
+ * of error presentation according to deployment-specific user interface requirements.
2836
+ */
2837
+ renderError,
2838
+
2839
+ /*
2840
+ * revokeGrantPolicy
2841
+ *
2842
+ * title: Grant Revocation Policy
2843
+ *
2844
+ * description: Specifies a helper function that shall be invoked to determine whether an
2845
+ * underlying Grant entry shall be revoked in addition to the specific token or code being
2846
+ * processed. This function enables enforcement of grant revocation policies according to
2847
+ * authorization server security requirements. The function is invoked in the following
2848
+ * contexts:
2849
+ * - RP-Initiated Logout
2850
+ * - Opaque Access Token Revocation
2851
+ * - Refresh Token Revocation
2852
+ * - Authorization Code re-use
2853
+ * - Device Code re-use
2854
+ * - Backchannel Authentication Request re-use
2855
+ * - Rotated Refresh Token re-use
2856
+ */
2857
+ revokeGrantPolicy,
2858
+
2859
+ /*
2860
+ * sectorIdentifierUriValidate
2861
+ *
2862
+ * title: Sector Identifier URI Validation
2863
+ *
2864
+ * description: Specifies a function that shall be invoked to determine whether the
2865
+ * sectorIdentifierUri of a client being loaded, registered, or updated should be fetched
2866
+ * and its contents validated against the client metadata.
2867
+ */
2868
+ sectorIdentifierUriValidate,
2869
+
2870
+ /*
2871
+ * interactions
2872
+ *
2873
+ * @important
2874
+ *
2875
+ * title: End-User Interaction Policy
2876
+ *
2877
+ * description: Specifies the configuration for interaction policy and end-user redirection
2878
+ * that shall be applied to determine when user interaction
2879
+ * is required during the authorization process. This configuration enables customization
2880
+ * of authentication and consent flows according to deployment-specific requirements.
2881
+ *
2882
+ * @nodefault
2883
+ */
2884
+ interactions: {
2885
+ /*
2886
+ * interactions.policy
2887
+ *
2888
+ * description: Specifies the structure of Prompts and their associated checks that shall
2889
+ * be applied during authorization request processing. The policy is formed by Prompt
2890
+ * and Check class instances that define the conditions under which user interaction
2891
+ * is required. The default policy implementation provides a fresh instance that can
2892
+ * be customized, and the relevant classes are exported for configuration purposes.
2893
+ *
2894
+ * example: default interaction policy description.
2895
+ *
2896
+ * The default interaction policy consists of two available prompts, login and consent
2897
+ *
2898
+ * - `login` does the following checks:
2899
+ * - no_session - checks that there's an established session, an authenticated end-user
2900
+ * - max_age - processes the max_age parameter (when the session's auth_time is too old it requires login)
2901
+ * - id_token_hint - processes the id_token_hint parameter (when the end-user sub differs it requires login)
2902
+ * - claims_id_token_sub_value - processes the claims parameter `sub` (when the `claims` parameter requested sub differs it requires login)
2903
+ * - essential_acrs - processes the claims parameter `acr` (when the current acr is not amongst the `claims` parameter essential `acr.values` it requires login)
2904
+ * - essential_acr - processes the claims parameter `acr` (when the current acr is not equal to the `claims` parameter essential `acr.value` it requires login)
2905
+ *
2906
+ * - `consent` does the following checks:
2907
+ * - native_client_prompt - native clients always require re-consent
2908
+ * - op_scopes_missing - requires consent when the requested scope includes scope values previously not requested
2909
+ * - op_claims_missing - requires consent when the requested claims parameter includes claims previously not requested
2910
+ * - rs_scopes_missing - requires consent when the requested resource indicated scope values include scopes previously not requested
2911
+ *
2912
+ * These checks are the best practice for various privacy and security reasons.
2913
+ *
2914
+ * example: disabling default consent checks.
2915
+ *
2916
+ * You may be required to skip (silently accept) some of the consent checks, while it is
2917
+ * discouraged there are valid reasons to do that, for instance in some first-party scenarios or
2918
+ * going with pre-existing, previously granted, consents. To simply silently "accept"
2919
+ * first-party/resource indicated scopes or pre-agreed-upon claims use the `loadExistingGrant`
2920
+ * configuration helper function, in there you may just instantiate (and save!) a grant for the
2921
+ * current clientId and accountId values.
2922
+ *
2923
+ * example: modifying the default interaction policy.
2924
+ *
2925
+ * ```js
2926
+ * import { interactionPolicy } from 'oidc-provider';
2927
+ * const { Prompt, Check, base } = interactionPolicy;
2928
+ *
2929
+ * const basePolicy = base()
2930
+ *
2931
+ * // basePolicy.get(name) => returns a Prompt instance by its name
2932
+ * // basePolicy.remove(name) => removes a Prompt instance by its name
2933
+ * // basePolicy.add(prompt, index) => adds a Prompt instance to a specific index, default is add the prompt as the last one
2934
+ *
2935
+ * // prompt.checks.get(reason) => returns a Check instance by its reason
2936
+ * // prompt.checks.remove(reason) => removes a Check instance by its reason
2937
+ * // prompt.checks.add(check, index) => adds a Check instance to a specific index, default is add the check as the last one
2938
+ * ```
2939
+ */
2940
+ policy: defaultPolicy(),
2941
+
2942
+ /*
2943
+ * interactions.url
2944
+ *
2945
+ * description: Specifies a function that shall be invoked to determine the destination URL
2946
+ * for redirecting the User-Agent when user interaction is required during authorization
2947
+ * processing. This function enables customization of the interaction endpoint location
2948
+ * and may return both absolute and relative URLs according to deployment requirements.
2949
+ */
2950
+ url: interactionsUrl,
2951
+ },
2952
+
2953
+ /*
2954
+ * findAccount
2955
+ *
2956
+ * @important
2957
+ *
2958
+ * title: Account Loading and Claims Resolution
2959
+ *
2960
+ * description: Specifies a function that shall be invoked to load an account and retrieve
2961
+ * its available claims during authorization server operations. This function enables
2962
+ * the authorization server to resolve end-user account information based on the provided
2963
+ * account identifier. The function MUST return a Promise that resolves to an account
2964
+ * object containing an `accountId` property and a `claims()` method that returns an
2965
+ * object with claims corresponding to the claims supported by the issuer. The `claims()`
2966
+ * method may also return a Promise that shall be resolved or rejected according to
2967
+ * account availability and authorization server policy.
2968
+ */
2969
+ findAccount,
2970
+
2971
+ /*
2972
+ * rotateRefreshToken
2973
+ *
2974
+ * title: Refresh Token Rotation Policy
2975
+ *
2976
+ * description: Specifies the refresh token rotation policy that shall be applied by the
2977
+ * authorization server when refresh tokens are used.
2978
+ * This configuration determines whether and under what conditions refresh tokens shall
2979
+ * be rotated. Supported values
2980
+ * include:
2981
+ * - `false` - refresh tokens shall not be rotated and their initial expiration date is final
2982
+ * - `true` - refresh tokens shall be rotated when used, with the current token marked as
2983
+ * consumed and a new one issued with new TTL; when a consumed refresh token is
2984
+ * encountered an error shall be returned and the whole token chain (grant) is revoked
2985
+ * - `function` - a function returning true/false that shall be invoked to determine
2986
+ * whether rotation should occur based on request context and authorization server policy
2987
+ *
2988
+ * The default configuration value implements a sensible refresh token rotation policy that:
2989
+ * - only allows refresh tokens to be rotated (have their TTL prolonged by issuing a new one) for one year
2990
+ * - otherwise always rotates public client tokens that are not sender-constrained
2991
+ * - otherwise only rotates tokens if they're being used close to their expiration (>= 70% TTL passed)
2992
+ */
2993
+ rotateRefreshToken,
2994
+
2995
+ /*
2996
+ * enabledJWA
2997
+ *
2998
+ * title: Supported JSON Web Algorithms (JWA)
2999
+ *
3000
+ * description: Specifies the JSON Web Algorithm (JWA) values supported by this authorization
3001
+ * server for various cryptographic operations, as defined in RFC 7518 and related specifications.
3002
+ * @nodefault
3003
+ */
3004
+ enabledJWA: {
3005
+ /*
3006
+ * enabledJWA.clientAuthSigningAlgValues
3007
+ *
3008
+ * description: JWS "alg" Algorithm values the authorization server supports for signed JWT Client Authentication
3009
+ * (`private_key_jwt` and `client_secret_jwt`)
3010
+ *
3011
+ * example: Supported values list.
3012
+ *
3013
+ * ```js
3014
+ * [
3015
+ * 'RS256', 'RS384', 'RS512',
3016
+ * 'PS256', 'PS384', 'PS512',
3017
+ * 'ES256', 'ES384', 'ES512',
3018
+ * 'Ed25519', 'EdDSA',
3019
+ * 'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87', // available in Node.js >= 24.7.0
3020
+ * 'HS256', 'HS384', 'HS512',
3021
+ * ]
3022
+ * ```
3023
+ */
3024
+ clientAuthSigningAlgValues: [
3025
+ 'HS256',
3026
+ 'RS256',
3027
+ 'PS256',
3028
+ 'ES256',
3029
+ 'Ed25519',
3030
+ 'EdDSA',
3031
+ ],
3032
+
3033
+ /*
3034
+ * enabledJWA.idTokenSigningAlgValues
3035
+ *
3036
+ * description: JWS "alg" Algorithm values the authorization server supports to sign ID Tokens with.
3037
+ *
3038
+ * example: Supported values list.
3039
+ *
3040
+ * ```js
3041
+ * [
3042
+ * 'RS256', 'RS384', 'RS512',
3043
+ * 'PS256', 'PS384', 'PS512',
3044
+ * 'ES256', 'ES384', 'ES512',
3045
+ * 'Ed25519', 'EdDSA',
3046
+ * 'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87', // available in Node.js >= 24.7.0
3047
+ * 'HS256', 'HS384', 'HS512',
3048
+ * ]
3049
+ * ```
3050
+ */
3051
+ idTokenSigningAlgValues: ['RS256', 'PS256', 'ES256', 'Ed25519', 'EdDSA'],
3052
+
3053
+ /*
3054
+ * enabledJWA.requestObjectSigningAlgValues
3055
+ *
3056
+ * description: JWS "alg" Algorithm values the authorization server supports to receive signed Request Objects (`JAR`) with
3057
+ *
3058
+ * example: Supported values list.
3059
+ *
3060
+ * ```js
3061
+ * [
3062
+ * 'RS256', 'RS384', 'RS512',
3063
+ * 'PS256', 'PS384', 'PS512',
3064
+ * 'ES256', 'ES384', 'ES512',
3065
+ * 'Ed25519', 'EdDSA',
3066
+ * 'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87', // available in Node.js >= 24.7.0
3067
+ * 'HS256', 'HS384', 'HS512',
3068
+ * ]
3069
+ * ```
3070
+ */
3071
+ requestObjectSigningAlgValues: [
3072
+ 'HS256',
3073
+ 'RS256',
3074
+ 'PS256',
3075
+ 'ES256',
3076
+ 'Ed25519',
3077
+ 'EdDSA',
3078
+ ],
3079
+
3080
+ /*
3081
+ * enabledJWA.userinfoSigningAlgValues
3082
+ *
3083
+ * description: JWS "alg" Algorithm values the authorization server supports to sign UserInfo responses with
3084
+ *
3085
+ * example: Supported values list.
3086
+ *
3087
+ * ```js
3088
+ * [
3089
+ * 'RS256', 'RS384', 'RS512',
3090
+ * 'PS256', 'PS384', 'PS512',
3091
+ * 'ES256', 'ES384', 'ES512',
3092
+ * 'Ed25519', 'EdDSA',
3093
+ * 'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87', // available in Node.js >= 24.7.0
3094
+ * 'HS256', 'HS384', 'HS512',
3095
+ * ]
3096
+ * ```
3097
+ */
3098
+ userinfoSigningAlgValues: ['RS256', 'PS256', 'ES256', 'Ed25519', 'EdDSA'],
3099
+
3100
+ /*
3101
+ * enabledJWA.introspectionSigningAlgValues
3102
+ *
3103
+ * description: JWS "alg" Algorithm values the authorization server supports to sign JWT Introspection responses with
3104
+ *
3105
+ * example: Supported values list.
3106
+ *
3107
+ * ```js
3108
+ * [
3109
+ * 'RS256', 'RS384', 'RS512',
3110
+ * 'PS256', 'PS384', 'PS512',
3111
+ * 'ES256', 'ES384', 'ES512',
3112
+ * 'Ed25519', 'EdDSA',
3113
+ * 'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87', // available in Node.js >= 24.7.0
3114
+ * 'HS256', 'HS384', 'HS512',
3115
+ * ]
3116
+ * ```
3117
+ */
3118
+ introspectionSigningAlgValues: [
3119
+ 'RS256',
3120
+ 'PS256',
3121
+ 'ES256',
3122
+ 'Ed25519',
3123
+ 'EdDSA',
3124
+ ],
3125
+
3126
+ /*
3127
+ * enabledJWA.authorizationSigningAlgValues
3128
+ *
3129
+ * description: JWS "alg" Algorithm values the authorization server supports to sign JWT Authorization Responses (`JARM`) with
3130
+ *
3131
+ * example: Supported values list.
3132
+ *
3133
+ * ```js
3134
+ * [
3135
+ * 'RS256', 'RS384', 'RS512',
3136
+ * 'PS256', 'PS384', 'PS512',
3137
+ * 'ES256', 'ES384', 'ES512',
3138
+ * 'Ed25519', 'EdDSA',
3139
+ * 'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87', // available in Node.js >= 24.7.0
3140
+ * 'HS256', 'HS384', 'HS512',
3141
+ * ]
3142
+ * ```
3143
+ */
3144
+ authorizationSigningAlgValues: [
3145
+ 'RS256',
3146
+ 'PS256',
3147
+ 'ES256',
3148
+ 'Ed25519',
3149
+ 'EdDSA',
3150
+ ],
3151
+
3152
+ /*
3153
+ * enabledJWA.idTokenEncryptionAlgValues
3154
+ *
3155
+ * description: JWE "alg" Algorithm values the authorization server supports for ID Token encryption
3156
+ *
3157
+ * example: Supported values list.
3158
+ *
3159
+ * ```js
3160
+ * [
3161
+ * // asymmetric RSAES based
3162
+ * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
3163
+ * // asymmetric ECDH-ES based
3164
+ * 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
3165
+ * // symmetric AES key wrapping
3166
+ * 'A128KW', 'A192KW', 'A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW',
3167
+ * // direct encryption
3168
+ * 'dir',
3169
+ * ]
3170
+ * ```
3171
+ */
3172
+ idTokenEncryptionAlgValues: [
3173
+ 'A128KW',
3174
+ 'A256KW',
3175
+ 'ECDH-ES',
3176
+ 'RSA-OAEP',
3177
+ 'RSA-OAEP-256',
3178
+ 'dir',
3179
+ ],
3180
+
3181
+ /*
3182
+ * enabledJWA.requestObjectEncryptionAlgValues
3183
+ *
3184
+ * description: JWE "alg" Algorithm values the authorization server supports to receive encrypted Request Objects (`JAR`) with
3185
+ *
3186
+ * example: Supported values list.
3187
+ *
3188
+ * ```js
3189
+ * [
3190
+ * // asymmetric RSAES based
3191
+ * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
3192
+ * // asymmetric ECDH-ES based
3193
+ * 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
3194
+ * // symmetric AES key wrapping
3195
+ * 'A128KW', 'A192KW', 'A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW',
3196
+ * // direct encryption
3197
+ * 'dir',
3198
+ * ]
3199
+ * ```
3200
+ */
3201
+ requestObjectEncryptionAlgValues: [
3202
+ 'A128KW',
3203
+ 'A256KW',
3204
+ 'ECDH-ES',
3205
+ 'RSA-OAEP',
3206
+ 'RSA-OAEP-256',
3207
+ 'dir',
3208
+ ],
3209
+
3210
+ /*
3211
+ * enabledJWA.userinfoEncryptionAlgValues
3212
+ *
3213
+ * description: JWE "alg" Algorithm values the authorization server supports for UserInfo Response encryption
3214
+ *
3215
+ * example: Supported values list.
3216
+ *
3217
+ * ```js
3218
+ * [
3219
+ * // asymmetric RSAES based
3220
+ * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
3221
+ * // asymmetric ECDH-ES based
3222
+ * 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
3223
+ * // symmetric AES key wrapping
3224
+ * 'A128KW', 'A192KW', 'A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW',
3225
+ * // direct encryption
3226
+ * 'dir',
3227
+ * ]
3228
+ * ```
3229
+ */
3230
+ userinfoEncryptionAlgValues: [
3231
+ 'A128KW',
3232
+ 'A256KW',
3233
+ 'ECDH-ES',
3234
+ 'RSA-OAEP',
3235
+ 'RSA-OAEP-256',
3236
+ 'dir',
3237
+ ],
3238
+
3239
+ /*
3240
+ * enabledJWA.introspectionEncryptionAlgValues
3241
+ *
3242
+ * description: JWE "alg" Algorithm values the authorization server supports for JWT Introspection response
3243
+ * encryption
3244
+ *
3245
+ * example: Supported values list.
3246
+ *
3247
+ * ```js
3248
+ * [
3249
+ * // asymmetric RSAES based
3250
+ * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
3251
+ * // asymmetric ECDH-ES based
3252
+ * 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
3253
+ * // symmetric AES key wrapping
3254
+ * 'A128KW', 'A192KW', 'A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW',
3255
+ * // direct encryption
3256
+ * 'dir',
3257
+ * ]
3258
+ * ```
3259
+ */
3260
+ introspectionEncryptionAlgValues: [
3261
+ 'A128KW',
3262
+ 'A256KW',
3263
+ 'ECDH-ES',
3264
+ 'RSA-OAEP',
3265
+ 'RSA-OAEP-256',
3266
+ 'dir',
3267
+ ],
3268
+
3269
+ /*
3270
+ * enabledJWA.authorizationEncryptionAlgValues
3271
+ *
3272
+ * description: JWE "alg" Algorithm values the authorization server supports for JWT Authorization response (`JARM`)
3273
+ * encryption
3274
+ *
3275
+ * example: Supported values list.
3276
+ *
3277
+ * ```js
3278
+ * [
3279
+ * // asymmetric RSAES based
3280
+ * 'RSA-OAEP', 'RSA-OAEP-256', 'RSA-OAEP-384', 'RSA-OAEP-512',
3281
+ * // asymmetric ECDH-ES based
3282
+ * 'ECDH-ES', 'ECDH-ES+A128KW', 'ECDH-ES+A192KW', 'ECDH-ES+A256KW',
3283
+ * // symmetric AES key wrapping
3284
+ * 'A128KW', 'A192KW', 'A256KW', 'A128GCMKW', 'A192GCMKW', 'A256GCMKW',
3285
+ * // direct encryption
3286
+ * 'dir',
3287
+ * ]
3288
+ * ```
3289
+ */
3290
+ authorizationEncryptionAlgValues: [
3291
+ 'A128KW',
3292
+ 'A256KW',
3293
+ 'ECDH-ES',
3294
+ 'RSA-OAEP',
3295
+ 'RSA-OAEP-256',
3296
+ 'dir',
3297
+ ],
3298
+
3299
+ /*
3300
+ * enabledJWA.idTokenEncryptionEncValues
3301
+ *
3302
+ * description: JWE "enc" Content Encryption Algorithm values the authorization server supports to encrypt ID Tokens with
3303
+ *
3304
+ * example: Supported values list.
3305
+ *
3306
+ * ```js
3307
+ * [
3308
+ * 'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
3309
+ * ]
3310
+ * ```
3311
+ */
3312
+ idTokenEncryptionEncValues: [
3313
+ 'A128CBC-HS256',
3314
+ 'A128GCM',
3315
+ 'A256CBC-HS512',
3316
+ 'A256GCM',
3317
+ ],
3318
+
3319
+ /*
3320
+ * enabledJWA.requestObjectEncryptionEncValues
3321
+ *
3322
+ * description: JWE "enc" Content Encryption Algorithm values the authorization server supports to decrypt Request Objects (`JAR`) with
3323
+ *
3324
+ * example: Supported values list.
3325
+ *
3326
+ * ```js
3327
+ * [
3328
+ * 'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
3329
+ * ]
3330
+ * ```
3331
+ */
3332
+ requestObjectEncryptionEncValues: [
3333
+ 'A128CBC-HS256',
3334
+ 'A128GCM',
3335
+ 'A256CBC-HS512',
3336
+ 'A256GCM',
3337
+ ],
3338
+
3339
+ /*
3340
+ * enabledJWA.userinfoEncryptionEncValues
3341
+ *
3342
+ * description: JWE "enc" Content Encryption Algorithm values the authorization server supports to encrypt UserInfo responses with
3343
+ *
3344
+ * example: Supported values list.
3345
+ *
3346
+ * ```js
3347
+ * [
3348
+ * 'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
3349
+ * ]
3350
+ * ```
3351
+ */
3352
+ userinfoEncryptionEncValues: [
3353
+ 'A128CBC-HS256',
3354
+ 'A128GCM',
3355
+ 'A256CBC-HS512',
3356
+ 'A256GCM',
3357
+ ],
3358
+
3359
+ /*
3360
+ * enabledJWA.introspectionEncryptionEncValues
3361
+ *
3362
+ * description: JWE "enc" Content Encryption Algorithm values the authorization server supports to encrypt JWT Introspection responses with
3363
+ *
3364
+ * example: Supported values list.
3365
+ *
3366
+ * ```js
3367
+ * [
3368
+ * 'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
3369
+ * ]
3370
+ * ```
3371
+ */
3372
+ introspectionEncryptionEncValues: [
3373
+ 'A128CBC-HS256',
3374
+ 'A128GCM',
3375
+ 'A256CBC-HS512',
3376
+ 'A256GCM',
3377
+ ],
3378
+
3379
+ /*
3380
+ * enabledJWA.authorizationEncryptionEncValues
3381
+ *
3382
+ * description: JWE "enc" Content Encryption Algorithm values the authorization server supports to encrypt JWT Authorization Responses (`JARM`) with
3383
+ *
3384
+ * example: Supported values list.
3385
+ *
3386
+ * ```js
3387
+ * [
3388
+ * 'A128CBC-HS256', 'A128GCM', 'A192CBC-HS384', 'A192GCM', 'A256CBC-HS512', 'A256GCM',
3389
+ * ]
3390
+ * ```
3391
+ */
3392
+ authorizationEncryptionEncValues: [
3393
+ 'A128CBC-HS256',
3394
+ 'A128GCM',
3395
+ 'A256CBC-HS512',
3396
+ 'A256GCM',
3397
+ ],
3398
+
3399
+ /*
3400
+ * enabledJWA.dPoPSigningAlgValues
3401
+ *
3402
+ * description: JWS "alg" Algorithm values the authorization server supports to verify signed DPoP proof JWTs with
3403
+ *
3404
+ * example: Supported values list.
3405
+ *
3406
+ * ```js
3407
+ * [
3408
+ * 'RS256', 'RS384', 'RS512',
3409
+ * 'PS256', 'PS384', 'PS512',
3410
+ * 'ES256', 'ES384', 'ES512',
3411
+ * 'Ed25519', 'EdDSA',
3412
+ * 'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87', // available in Node.js >= 24.7.0
3413
+ * ]
3414
+ * ```
3415
+ */
3416
+ dPoPSigningAlgValues: ['ES256', 'Ed25519', 'EdDSA'],
3417
+
3418
+ /*
3419
+ * enabledJWA.attestSigningAlgValues
3420
+ *
3421
+ * description: JWS "alg" Algorithm values the authorization server supports to verify signed Client Attestation and Client Attestation PoP JWTs with
3422
+ *
3423
+ * example: Supported values list.
3424
+ *
3425
+ * ```js
3426
+ * [
3427
+ * 'RS256', 'RS384', 'RS512',
3428
+ * 'PS256', 'PS384', 'PS512',
3429
+ * 'ES256', 'ES384', 'ES512',
3430
+ * 'Ed25519', 'EdDSA',
3431
+ * 'ML-DSA-44', 'ML-DSA-65', 'ML-DSA-87', // available in Node.js >= 24.7.0
3432
+ * ]
3433
+ * ```
3434
+ */
3435
+ attestSigningAlgValues: ['ES256', 'Ed25519', 'EdDSA'],
3436
+ },
3437
+
3438
+ /*
3439
+ * assertJwtClientAuthClaimsAndHeader
3440
+ *
3441
+ * title: JWT Client Authentication Assertion Validation
3442
+ *
3443
+ * description: Specifies a helper function that shall be invoked to perform additional
3444
+ * validation of JWT Client Authentication assertion Claims Set and Header beyond the
3445
+ * requirements mandated by the specification. This function enables enforcement of
3446
+ * deployment-specific security policies and extended validation logic for `private_key_jwt`
3447
+ * and `client_secret_jwt` client authentication methods according to authorization
3448
+ * server requirements.
3449
+ */
3450
+ assertJwtClientAuthClaimsAndHeader,
3451
+
3452
+ /*
3453
+ * fetch
3454
+ *
3455
+ * title: Fetching External Resources
3456
+ *
3457
+ * description: Specifies a function that shall be invoked whenever the authorization server
3458
+ * needs to make calls to external HTTPS resources. The interface and expected return
3459
+ * value shall conform to the [Fetch API specification](https://fetch.spec.whatwg.org/)
3460
+ * [`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/Window/fetch) standard.
3461
+ *
3462
+ * Before each invocation the authorization server sets the following fetch options:
3463
+ * - `signal` to `AbortSignal.timeout(2500)`
3464
+ * - `headers` to a new `Headers` instance with the `user-agent` header set to an empty
3465
+ * string in order to remove the default one
3466
+ * - `dispatcher` to a custom `undici.Agent` that rejects connections to private,
3467
+ * loopback, and other non-globally-routable IP addresses, preventing Server-Side
3468
+ * Request Forgery (SSRF)
3469
+ */
3470
+ fetch: (url, options) => globalThis.fetch(url, options),
3471
+
3472
+ /*
3473
+ * fetchResponseBodyLimits
3474
+ *
3475
+ * title: Fetch Response Body Size Limits
3476
+ *
3477
+ * description: Specifies per-purpose maximum response body size limits (in bytes) for
3478
+ * external HTTPS resource fetches. When a limit is defined for a given purpose, the
3479
+ * authorization server will bail out early on `Content-Length` header values exceeding
3480
+ * the limit and will also abort reading the response body when the accumulated size
3481
+ * exceeds the limit. Purposes with a limit of `Infinity` will not enforce
3482
+ * any size restriction.
3483
+ */
3484
+ fetchResponseBodyLimits: {
3485
+ 'client_id metadata document': 5 * 1024,
3486
+ // TODO: introduce default limits in v10.x
3487
+ jwks_uri: Infinity,
3488
+ // TODO: introduce default limits in v10.x
3489
+ sector_identifier_uri: Infinity,
3490
+ },
3491
+
3492
+ /*
3493
+ * enableHttpPostMethods
3494
+ *
3495
+ * title: HTTP POST Method Support
3496
+ *
3497
+ * description: Specifies whether HTTP POST method support shall be enabled at the
3498
+ * Authorization Endpoint and the Logout Endpoint (if enabled). When enabled, the
3499
+ * authorization server shall accept POST requests at these endpoints in addition
3500
+ * to the standard GET requests. This configuration may only be used when the
3501
+ * `cookies.long.sameSite` configuration value is `none`.
3502
+ */
3503
+ enableHttpPostMethods: false,
3504
+ };
3505
+
3506
+ return defaults;
3507
+ }
3508
+
3509
+ export default makeDefaults;
3510
+ export const defaults = makeDefaults();