@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.
- package/LICENSE.txt +107 -0
- package/README.md +14 -0
- package/build.config.ts +46 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/ErrorPage.d.ts +11 -0
- package/dist/client/InteractionPage.d.ts +11 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/models/index.d.ts +11 -0
- package/dist/client/plugin.d.ts +13 -0
- package/dist/externalVersion.js +18 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +1 -0
- package/dist/locale/zh-CN.json +1 -0
- package/dist/node_modules/eta/LICENSE +7 -0
- package/dist/node_modules/eta/README.md +185 -0
- package/dist/node_modules/eta/dist/core.d.ts +179 -0
- package/dist/node_modules/eta/dist/core.d.ts.map +1 -0
- package/dist/node_modules/eta/dist/core.js +42 -0
- package/dist/node_modules/eta/dist/core.js.map +1 -0
- package/dist/node_modules/eta/dist/index.cjs +542 -0
- package/dist/node_modules/eta/dist/index.cjs.map +1 -0
- package/dist/node_modules/eta/dist/index.d.cts +187 -0
- package/dist/node_modules/eta/dist/index.d.cts.map +1 -0
- package/dist/node_modules/eta/dist/index.d.mts +187 -0
- package/dist/node_modules/eta/dist/index.d.mts.map +1 -0
- package/dist/node_modules/eta/dist/index.mjs +512 -0
- package/dist/node_modules/eta/dist/index.mjs.map +1 -0
- package/dist/node_modules/eta/package.json +75 -0
- package/dist/node_modules/jose/LICENSE.md +21 -0
- package/dist/node_modules/jose/README.md +153 -0
- package/dist/node_modules/jose/dist/types/index.d.ts +55 -0
- package/dist/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +31 -0
- package/dist/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +65 -0
- package/dist/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +31 -0
- package/dist/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +83 -0
- package/dist/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +38 -0
- package/dist/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +74 -0
- package/dist/node_modules/jose/dist/types/jwk/embedded.d.ts +17 -0
- package/dist/node_modules/jose/dist/types/jwk/thumbprint.d.ts +32 -0
- package/dist/node_modules/jose/dist/types/jwks/local.d.ts +29 -0
- package/dist/node_modules/jose/dist/types/jwks/remote.d.ts +237 -0
- package/dist/node_modules/jose/dist/types/jws/compact/sign.d.ts +36 -0
- package/dist/node_modules/jose/dist/types/jws/compact/verify.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/jws/flattened/sign.d.ts +42 -0
- package/dist/node_modules/jose/dist/types/jws/flattened/verify.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/jws/general/sign.d.ts +53 -0
- package/dist/node_modules/jose/dist/types/jws/general/verify.d.ts +41 -0
- package/dist/node_modules/jose/dist/types/jwt/decrypt.d.ts +35 -0
- package/dist/node_modules/jose/dist/types/jwt/encrypt.d.ts +91 -0
- package/dist/node_modules/jose/dist/types/jwt/sign.d.ts +43 -0
- package/dist/node_modules/jose/dist/types/jwt/unsecured.d.ts +43 -0
- package/dist/node_modules/jose/dist/types/jwt/verify.d.ts +37 -0
- package/dist/node_modules/jose/dist/types/key/export.d.ts +33 -0
- package/dist/node_modules/jose/dist/types/key/generate_key_pair.d.ts +47 -0
- package/dist/node_modules/jose/dist/types/key/generate_secret.d.ts +35 -0
- package/dist/node_modules/jose/dist/types/key/import.d.ts +83 -0
- package/dist/node_modules/jose/dist/types/types.d.ts +852 -0
- package/dist/node_modules/jose/dist/types/util/base64url.d.ts +9 -0
- package/dist/node_modules/jose/dist/types/util/decode_jwt.d.ts +18 -0
- package/dist/node_modules/jose/dist/types/util/decode_protected_header.d.ts +17 -0
- package/dist/node_modules/jose/dist/types/util/errors.d.ts +213 -0
- package/dist/node_modules/jose/dist/webapi/index.js +32 -0
- package/dist/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +27 -0
- package/dist/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +27 -0
- package/dist/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +155 -0
- package/dist/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +165 -0
- package/dist/node_modules/jose/dist/webapi/jwe/general/decrypt.js +31 -0
- package/dist/node_modules/jose/dist/webapi/jwe/general/encrypt.js +182 -0
- package/dist/node_modules/jose/dist/webapi/jwk/embedded.js +17 -0
- package/dist/node_modules/jose/dist/webapi/jwk/thumbprint.js +68 -0
- package/dist/node_modules/jose/dist/webapi/jwks/local.js +119 -0
- package/dist/node_modules/jose/dist/webapi/jwks/remote.js +179 -0
- package/dist/node_modules/jose/dist/webapi/jws/compact/sign.js +18 -0
- package/dist/node_modules/jose/dist/webapi/jws/compact/verify.js +21 -0
- package/dist/node_modules/jose/dist/webapi/jws/flattened/sign.js +89 -0
- package/dist/node_modules/jose/dist/webapi/jws/flattened/verify.js +110 -0
- package/dist/node_modules/jose/dist/webapi/jws/general/sign.js +70 -0
- package/dist/node_modules/jose/dist/webapi/jws/general/verify.js +24 -0
- package/dist/node_modules/jose/dist/webapi/jwt/decrypt.js +23 -0
- package/dist/node_modules/jose/dist/webapi/jwt/encrypt.js +101 -0
- package/dist/node_modules/jose/dist/webapi/jwt/sign.js +52 -0
- package/dist/node_modules/jose/dist/webapi/jwt/unsecured.js +63 -0
- package/dist/node_modules/jose/dist/webapi/jwt/verify.js +15 -0
- package/dist/node_modules/jose/dist/webapi/key/export.js +11 -0
- package/dist/node_modules/jose/dist/webapi/key/generate_key_pair.js +97 -0
- package/dist/node_modules/jose/dist/webapi/key/generate_secret.js +40 -0
- package/dist/node_modules/jose/dist/webapi/key/import.js +57 -0
- package/dist/node_modules/jose/dist/webapi/lib/aesgcmkw.js +15 -0
- package/dist/node_modules/jose/dist/webapi/lib/aeskw.js +25 -0
- package/dist/node_modules/jose/dist/webapi/lib/asn1.js +243 -0
- package/dist/node_modules/jose/dist/webapi/lib/base64.js +22 -0
- package/dist/node_modules/jose/dist/webapi/lib/buffer_utils.js +43 -0
- package/dist/node_modules/jose/dist/webapi/lib/check_key_type.js +122 -0
- package/dist/node_modules/jose/dist/webapi/lib/content_encryption.js +217 -0
- package/dist/node_modules/jose/dist/webapi/lib/crypto_key.js +136 -0
- package/dist/node_modules/jose/dist/webapi/lib/deflate.js +44 -0
- package/dist/node_modules/jose/dist/webapi/lib/ecdhes.js +52 -0
- package/dist/node_modules/jose/dist/webapi/lib/helpers.js +19 -0
- package/dist/node_modules/jose/dist/webapi/lib/invalid_key_input.js +27 -0
- package/dist/node_modules/jose/dist/webapi/lib/is_key_like.js +17 -0
- package/dist/node_modules/jose/dist/webapi/lib/jwk_to_key.js +107 -0
- package/dist/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +238 -0
- package/dist/node_modules/jose/dist/webapi/lib/key_management.js +186 -0
- package/dist/node_modules/jose/dist/webapi/lib/key_to_jwk.js +31 -0
- package/dist/node_modules/jose/dist/webapi/lib/normalize_key.js +166 -0
- package/dist/node_modules/jose/dist/webapi/lib/pbes2kw.js +39 -0
- package/dist/node_modules/jose/dist/webapi/lib/rsaes.js +24 -0
- package/dist/node_modules/jose/dist/webapi/lib/signing.js +68 -0
- package/dist/node_modules/jose/dist/webapi/lib/type_checks.js +40 -0
- package/dist/node_modules/jose/dist/webapi/lib/validate_algorithms.js +10 -0
- package/dist/node_modules/jose/dist/webapi/lib/validate_crit.js +33 -0
- package/dist/node_modules/jose/dist/webapi/util/base64url.js +30 -0
- package/dist/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -0
- package/dist/node_modules/jose/dist/webapi/util/decode_protected_header.js +34 -0
- package/dist/node_modules/jose/dist/webapi/util/errors.js +99 -0
- package/dist/node_modules/jose/package.json +200 -0
- package/dist/node_modules/light-my-request/.gitattributes +2 -0
- package/dist/node_modules/light-my-request/.github/dependabot.yml +13 -0
- package/dist/node_modules/light-my-request/.github/stale.yml +21 -0
- package/dist/node_modules/light-my-request/.github/workflows/benchmark.yml +30 -0
- package/dist/node_modules/light-my-request/.github/workflows/ci.yml +23 -0
- package/dist/node_modules/light-my-request/LICENSE +32 -0
- package/dist/node_modules/light-my-request/benchmark/benchmark.js +164 -0
- package/dist/node_modules/light-my-request/build/build-validation.js +100 -0
- package/dist/node_modules/light-my-request/eslint.config.js +9 -0
- package/dist/node_modules/light-my-request/index.js +2 -0
- package/dist/node_modules/light-my-request/lib/config-validator.js +919 -0
- package/dist/node_modules/light-my-request/lib/form-data.js +79 -0
- package/dist/node_modules/light-my-request/lib/parse-url.js +47 -0
- package/dist/node_modules/light-my-request/lib/request.js +290 -0
- package/dist/node_modules/light-my-request/lib/response.js +240 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.gitattributes +2 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.github/dependabot.yml +13 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.github/workflows/ci.yml +24 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/.taprc +2 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/benchmarks/warn.js +25 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/eslint.config.js +6 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/examples/example.js +11 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/index.js +124 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/package.json +73 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-interpolated-string.test.js +29 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-once-only.test.js +28 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-reset.test.js +36 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-set.test.js +30 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/emit-unlimited.test.js +37 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/index.test.js +99 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/issue-88.test.js +33 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/jest.test.js +22 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/test/no-warnings.test.js +80 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.d.ts +37 -0
- package/dist/node_modules/light-my-request/node_modules/process-warning/types/index.test-d.ts +36 -0
- package/dist/node_modules/light-my-request/package.json +1 -0
- package/dist/node_modules/light-my-request/test/async-await.test.js +55 -0
- package/dist/node_modules/light-my-request/test/index.test.js +2316 -0
- package/dist/node_modules/light-my-request/test/request.test.js +16 -0
- package/dist/node_modules/light-my-request/test/response.test.js +19 -0
- package/dist/node_modules/light-my-request/test/stream.test.js +359 -0
- package/dist/node_modules/light-my-request/types/index.d.ts +128 -0
- package/dist/node_modules/light-my-request/types/index.test-d.ts +149 -0
- package/dist/node_modules/oidc-provider/LICENSE.md +21 -0
- package/dist/node_modules/oidc-provider/README.md +174 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/assign_claims.js +28 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/assign_defaults.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/authenticated_client_id.js +6 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/backchannel_request_remap_errors.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/backchannel_request_response.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_ciba_context.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_claims.js +68 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_client.js +21 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_client_grant_type.js +21 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_dpop_jkt.js +35 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_extra_params.js +18 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_id_token_hint.js +23 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_max_age.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_openid_scope.js +47 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_pkce.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_prompt.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_redirect_uri.js +41 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_requested_expiry.js +16 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_response_mode.js +54 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_response_type.js +26 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/check_scope.js +53 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/ciba_load_account.js +58 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/ciba_required.js +13 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_authorization_response.js +31 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow.js +31 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow_errors.js +37 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/device_user_flow_response.js +55 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/index.js +200 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/interaction_emit.js +9 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/interactions.js +149 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_account.js +15 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_grant.js +29 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/load_pushed_authorization_request.js +36 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/oauth_required.js +11 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/oidc_required.js +27 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/one_redirect_uri_clients.js +20 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/process_request_object.js +214 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/pushed_authorization_request_remap_errors.js +17 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/pushed_authorization_request_response.js +65 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_registration.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_request_and_uri.js +12 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/reject_unsupported.js +33 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/respond.js +46 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/resume.js +111 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/strip_outside_jar_params.js +19 -0
- package/dist/node_modules/oidc-provider/lib/actions/authorization/unsupported_rar.js +9 -0
- package/dist/node_modules/oidc-provider/lib/actions/challenge.js +22 -0
- package/dist/node_modules/oidc-provider/lib/actions/code_verification.js +122 -0
- package/dist/node_modules/oidc-provider/lib/actions/discovery.js +151 -0
- package/dist/node_modules/oidc-provider/lib/actions/end_session.js +222 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/authorization_code.js +144 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/ciba.js +127 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/client_credentials.js +79 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/device_code.js +125 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/index.js +7 -0
- package/dist/node_modules/oidc-provider/lib/actions/grants/refresh_token.js +229 -0
- package/dist/node_modules/oidc-provider/lib/actions/index.js +25 -0
- package/dist/node_modules/oidc-provider/lib/actions/interaction.js +150 -0
- package/dist/node_modules/oidc-provider/lib/actions/introspection.js +164 -0
- package/dist/node_modules/oidc-provider/lib/actions/jwks.js +7 -0
- package/dist/node_modules/oidc-provider/lib/actions/registration.js +274 -0
- package/dist/node_modules/oidc-provider/lib/actions/revocation.js +81 -0
- package/dist/node_modules/oidc-provider/lib/actions/token.js +74 -0
- package/dist/node_modules/oidc-provider/lib/actions/userinfo.js +183 -0
- package/dist/node_modules/oidc-provider/lib/adapters/memory_adapter.js +95 -0
- package/dist/node_modules/oidc-provider/lib/consts/client_attributes.js +211 -0
- package/dist/node_modules/oidc-provider/lib/consts/dev_keystore.js +18 -0
- package/dist/node_modules/oidc-provider/lib/consts/index.js +13 -0
- package/dist/node_modules/oidc-provider/lib/consts/jwa.js +47 -0
- package/dist/node_modules/oidc-provider/lib/consts/non_rejectable_claims.js +1 -0
- package/dist/node_modules/oidc-provider/lib/consts/param_list.js +23 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/camel_case.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/defaults.js +28 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/difference.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/is_plain_object.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/map_keys.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/merge.js +25 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/omit_by.js +11 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/pick.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/pick_by.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/remove.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/set.js +18 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/snake_case.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/_/upper_first.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/account_claims.js +6 -0
- package/dist/node_modules/oidc-provider/lib/helpers/add_client.js +14 -0
- package/dist/node_modules/oidc-provider/lib/helpers/als.js +3 -0
- package/dist/node_modules/oidc-provider/lib/helpers/append_www_authenticate.js +9 -0
- package/dist/node_modules/oidc-provider/lib/helpers/attention.js +23 -0
- package/dist/node_modules/oidc-provider/lib/helpers/base64url.js +11 -0
- package/dist/node_modules/oidc-provider/lib/helpers/certificate_thumbprint.js +15 -0
- package/dist/node_modules/oidc-provider/lib/helpers/challenge.js +111 -0
- package/dist/node_modules/oidc-provider/lib/helpers/check_attest_binding.js +10 -0
- package/dist/node_modules/oidc-provider/lib/helpers/claims.js +79 -0
- package/dist/node_modules/oidc-provider/lib/helpers/client_id_metadata_document.js +198 -0
- package/dist/node_modules/oidc-provider/lib/helpers/client_schema.js +700 -0
- package/dist/node_modules/oidc-provider/lib/helpers/combined_scope.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/configuration.js +544 -0
- package/dist/node_modules/oidc-provider/lib/helpers/constant_equals.js +20 -0
- package/dist/node_modules/oidc-provider/lib/helpers/defaults.js +3510 -0
- package/dist/node_modules/oidc-provider/lib/helpers/epoch_time.js +1 -0
- package/dist/node_modules/oidc-provider/lib/helpers/err_out.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/errors.js +161 -0
- package/dist/node_modules/oidc-provider/lib/helpers/features.js +51 -0
- package/dist/node_modules/oidc-provider/lib/helpers/fetch_body_check.js +25 -0
- package/dist/node_modules/oidc-provider/lib/helpers/fetch_request.js +221 -0
- package/dist/node_modules/oidc-provider/lib/helpers/filter_claims.js +16 -0
- package/dist/node_modules/oidc-provider/lib/helpers/formatters.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/grant_common.js +214 -0
- package/dist/node_modules/oidc-provider/lib/helpers/html_safe.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_adapter.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_app.js +243 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_clients.js +24 -0
- package/dist/node_modules/oidc-provider/lib/helpers/initialize_keystore.js +310 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/check.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/index.js +43 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompt.js +95 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompts/consent.js +105 -0
- package/dist/node_modules/oidc-provider/lib/helpers/interaction_policy/prompts/login.js +162 -0
- package/dist/node_modules/oidc-provider/lib/helpers/jwt.js +211 -0
- package/dist/node_modules/oidc-provider/lib/helpers/keystore.js +301 -0
- package/dist/node_modules/oidc-provider/lib/helpers/nanoid.js +5 -0
- package/dist/node_modules/oidc-provider/lib/helpers/oidc_context.js +284 -0
- package/dist/node_modules/oidc-provider/lib/helpers/params.js +27 -0
- package/dist/node_modules/oidc-provider/lib/helpers/pkce.js +30 -0
- package/dist/node_modules/oidc-provider/lib/helpers/pkce_format.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/process_response_types.js +202 -0
- package/dist/node_modules/oidc-provider/lib/helpers/re_render_errors.js +39 -0
- package/dist/node_modules/oidc-provider/lib/helpers/redirect_uri.js +16 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resolve_resource.js +33 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resolve_response_mode.js +7 -0
- package/dist/node_modules/oidc-provider/lib/helpers/resource_server.js +20 -0
- package/dist/node_modules/oidc-provider/lib/helpers/revoke.js +27 -0
- package/dist/node_modules/oidc-provider/lib/helpers/script_src_sha.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/sector_identifier.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/sector_validate.js +55 -0
- package/dist/node_modules/oidc-provider/lib/helpers/set_rt_bindings.js +21 -0
- package/dist/node_modules/oidc-provider/lib/helpers/token_find.js +51 -0
- package/dist/node_modules/oidc-provider/lib/helpers/type_validators.js +8 -0
- package/dist/node_modules/oidc-provider/lib/helpers/user_code_form.js +19 -0
- package/dist/node_modules/oidc-provider/lib/helpers/user_codes.js +38 -0
- package/dist/node_modules/oidc-provider/lib/helpers/valid_url.js +8 -0
- package/dist/node_modules/oidc-provider/lib/helpers/validate_dpop.js +129 -0
- package/dist/node_modules/oidc-provider/lib/helpers/validate_presence.js +17 -0
- package/dist/node_modules/oidc-provider/lib/helpers/weak_cache.js +11 -0
- package/dist/node_modules/oidc-provider/lib/index.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/access_token.js +31 -0
- package/dist/node_modules/oidc-provider/lib/models/authorization_code.js +27 -0
- package/dist/node_modules/oidc-provider/lib/models/backchannel_authentication_request.js +26 -0
- package/dist/node_modules/oidc-provider/lib/models/base_model.js +141 -0
- package/dist/node_modules/oidc-provider/lib/models/base_token.js +86 -0
- package/dist/node_modules/oidc-provider/lib/models/client.js +593 -0
- package/dist/node_modules/oidc-provider/lib/models/client_credentials.js +19 -0
- package/dist/node_modules/oidc-provider/lib/models/device_code.js +44 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/dynamic.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/index.js +14 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/jwt.js +198 -0
- package/dist/node_modules/oidc-provider/lib/models/formats/opaque.js +58 -0
- package/dist/node_modules/oidc-provider/lib/models/grant.js +243 -0
- package/dist/node_modules/oidc-provider/lib/models/id_token.js +271 -0
- package/dist/node_modules/oidc-provider/lib/models/index.js +37 -0
- package/dist/node_modules/oidc-provider/lib/models/initial_access_token.js +12 -0
- package/dist/node_modules/oidc-provider/lib/models/interaction.js +73 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/apply.js +4 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/consumable.js +17 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_format.js +46 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_grant_id.js +12 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_grant_type.js +8 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/has_policies.js +38 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_attestation_constrained.js +15 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_sender_constrained.js +50 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/is_session_bound.js +38 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/set_audience.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/stores_auth.js +16 -0
- package/dist/node_modules/oidc-provider/lib/models/mixins/stores_pkce.js +9 -0
- package/dist/node_modules/oidc-provider/lib/models/pushed_authorization_request.js +21 -0
- package/dist/node_modules/oidc-provider/lib/models/refresh_token.js +47 -0
- package/dist/node_modules/oidc-provider/lib/models/registration_access_token.js +8 -0
- package/dist/node_modules/oidc-provider/lib/models/replay_detection.js +31 -0
- package/dist/node_modules/oidc-provider/lib/models/session.js +192 -0
- package/dist/node_modules/oidc-provider/lib/provider.js +453 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/form_post.js +36 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/fragment.js +7 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/index.js +15 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/jwt.js +43 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/query.js +7 -0
- package/dist/node_modules/oidc-provider/lib/response_modes/web_message.js +55 -0
- package/dist/node_modules/oidc-provider/lib/shared/assemble_params.js +7 -0
- package/dist/node_modules/oidc-provider/lib/shared/attest_client_auth.js +111 -0
- package/dist/node_modules/oidc-provider/lib/shared/authorization_error_handler.js +104 -0
- package/dist/node_modules/oidc-provider/lib/shared/check_rar.js +75 -0
- package/dist/node_modules/oidc-provider/lib/shared/check_resource.js +77 -0
- package/dist/node_modules/oidc-provider/lib/shared/client_auth.js +263 -0
- package/dist/node_modules/oidc-provider/lib/shared/conditional_body.js +9 -0
- package/dist/node_modules/oidc-provider/lib/shared/cors.js +49 -0
- package/dist/node_modules/oidc-provider/lib/shared/error_handler.js +59 -0
- package/dist/node_modules/oidc-provider/lib/shared/jwt_client_auth.js +79 -0
- package/dist/node_modules/oidc-provider/lib/shared/no_cache.js +4 -0
- package/dist/node_modules/oidc-provider/lib/shared/reject_dupes.js +45 -0
- package/dist/node_modules/oidc-provider/lib/shared/reject_structured_tokens.js +18 -0
- package/dist/node_modules/oidc-provider/lib/shared/selective_body.js +60 -0
- package/dist/node_modules/oidc-provider/lib/shared/session.js +68 -0
- package/dist/node_modules/oidc-provider/lib/shared/set_www_authenticate_header.js +52 -0
- package/dist/node_modules/oidc-provider/lib/views/index.js +22 -0
- package/dist/node_modules/oidc-provider/lib/views/interaction.js +171 -0
- package/dist/node_modules/oidc-provider/lib/views/layout.js +237 -0
- package/dist/node_modules/oidc-provider/lib/views/login.js +43 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/LICENSE +21 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/README.md +1370 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.d.mts +1003 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.d.ts +1003 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.js +1616 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/dist/index.mjs +1573 -0
- package/dist/node_modules/oidc-provider/node_modules/@koa/router/package.json +122 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/LICENSE +20 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/README.md +481 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/package.json +64 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/browser.js +272 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/common.js +292 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/index.js +10 -0
- package/dist/node_modules/oidc-provider/node_modules/debug/src/node.js +263 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/HISTORY.md +186 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/LICENSE +23 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/README.md +169 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/index.js +290 -0
- package/dist/node_modules/oidc-provider/node_modules/http-errors/package.json +54 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/LICENSE-MIT.txt +20 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/README.md +422 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/bin/jsesc +148 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/jsesc.js +337 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/man/jsesc.1 +94 -0
- package/dist/node_modules/oidc-provider/node_modules/jsesc/package.json +56 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/LICENSE +20 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/README.md +38 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/bin/nanoid.js +55 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.browser.js +29 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.d.ts +106 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/index.js +47 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/nanoid.js +1 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/non-secure/index.d.ts +48 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/non-secure/index.js +21 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/package.json +46 -0
- package/dist/node_modules/oidc-provider/node_modules/nanoid/url-alphabet/index.js +2 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/LICENSE +21 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/Readme.md +224 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.d.ts +144 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.js +409 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/dist/index.js.map +1 -0
- package/dist/node_modules/oidc-provider/node_modules/path-to-regexp/package.json +64 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/HISTORY.md +87 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/LICENSE +23 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/README.md +139 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/codes.json +65 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/index.js +146 -0
- package/dist/node_modules/oidc-provider/node_modules/statuses/package.json +49 -0
- package/dist/node_modules/oidc-provider/package.json +95 -0
- package/dist/node_modules/quick-lru/index.d.ts +178 -0
- package/dist/node_modules/quick-lru/index.js +329 -0
- package/dist/node_modules/quick-lru/license +9 -0
- package/dist/node_modules/quick-lru/package.json +54 -0
- package/dist/node_modules/quick-lru/readme.md +236 -0
- package/dist/node_modules/statuses/HISTORY.md +65 -0
- package/dist/node_modules/statuses/LICENSE +23 -0
- package/dist/node_modules/statuses/README.md +127 -0
- package/dist/node_modules/statuses/codes.json +66 -0
- package/dist/node_modules/statuses/index.js +113 -0
- package/dist/node_modules/statuses/package.json +48 -0
- package/dist/server/cache-adapter.d.ts +33 -0
- package/dist/server/cache-adapter.js +159 -0
- package/dist/server/index.d.ts +10 -0
- package/dist/server/index.js +48 -0
- package/dist/server/interaction.d.ts +26 -0
- package/dist/server/interaction.js +172 -0
- package/dist/server/paths.d.ts +19 -0
- package/dist/server/paths.js +64 -0
- package/dist/server/plugin.d.ts +16 -0
- package/dist/server/plugin.js +108 -0
- package/dist/server/provider-dispatch.d.ts +32 -0
- package/dist/server/provider-dispatch.js +252 -0
- package/dist/server/service.d.ts +63 -0
- package/dist/server/service.js +540 -0
- package/dist/server/utils.d.ts +12 -0
- package/dist/server/utils.js +58 -0
- package/package.json +24 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
/* eslint-disable no-unused-expressions */
|
|
2
|
+
import { format } from 'node:util';
|
|
3
|
+
import * as crypto from 'node:crypto';
|
|
4
|
+
|
|
5
|
+
import merge from '../helpers/_/merge.js';
|
|
6
|
+
import epochTime from '../helpers/epoch_time.js';
|
|
7
|
+
import * as JWT from '../helpers/jwt.js';
|
|
8
|
+
import { InvalidClientMetadata } from '../helpers/errors.js';
|
|
9
|
+
import instance from '../helpers/weak_cache.js';
|
|
10
|
+
import isPlainObject from '../helpers/_/is_plain_object.js';
|
|
11
|
+
|
|
12
|
+
const hashes = ['at_hash', 'c_hash', 's_hash'];
|
|
13
|
+
|
|
14
|
+
function getHashArgs(alg) {
|
|
15
|
+
switch (alg) {
|
|
16
|
+
case 'RS256':
|
|
17
|
+
case 'PS256':
|
|
18
|
+
case 'ES256':
|
|
19
|
+
case 'HS256':
|
|
20
|
+
return 'sha256';
|
|
21
|
+
case 'RS384':
|
|
22
|
+
case 'PS384':
|
|
23
|
+
case 'ES384':
|
|
24
|
+
case 'HS384':
|
|
25
|
+
return 'sha384';
|
|
26
|
+
case 'RS512':
|
|
27
|
+
case 'PS512':
|
|
28
|
+
case 'ES512':
|
|
29
|
+
case 'HS512':
|
|
30
|
+
case 'Ed25519':
|
|
31
|
+
case 'EdDSA': // alias for Ed25519, Ed448 is not supported
|
|
32
|
+
return 'sha512';
|
|
33
|
+
case 'ML-DSA-44':
|
|
34
|
+
case 'ML-DSA-65':
|
|
35
|
+
case 'ML-DSA-87':
|
|
36
|
+
return ['shake256', { outputLength: 64 }];
|
|
37
|
+
default:
|
|
38
|
+
throw new Error('not implemented');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const messages = {
|
|
43
|
+
sig: {
|
|
44
|
+
idtoken: 'client secret is expired - cannot issue an ID Token (%s)',
|
|
45
|
+
logout: 'client secret is expired - cannot issue a Logout Token (%s)',
|
|
46
|
+
userinfo: 'client secret is expired - cannot respond with %s JWT UserInfo response',
|
|
47
|
+
introspection: 'client secret is expired - cannot respond with %s JWT Introspection response',
|
|
48
|
+
},
|
|
49
|
+
enc: {
|
|
50
|
+
idtoken: 'client secret is expired - cannot issue an encrypted ID Token (%s)',
|
|
51
|
+
logout: 'client secret is expired - cannot issue an encrypted Logout Token (%s)',
|
|
52
|
+
userinfo: 'client secret is expired - cannot respond with %s encrypted JWT UserInfo response',
|
|
53
|
+
introspection: 'client secret is expired - cannot respond with %s encrypted JWT Introspection response',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default function getIdToken(provider) {
|
|
58
|
+
return class IdToken {
|
|
59
|
+
constructor(available, { ctx, client = ctx ? ctx.oidc.client : undefined }) {
|
|
60
|
+
if (!isPlainObject(available)) {
|
|
61
|
+
throw new TypeError('expected claims to be an object, are you sure claims() method resolves with or returns one?');
|
|
62
|
+
}
|
|
63
|
+
this.extra = {};
|
|
64
|
+
this.available = available;
|
|
65
|
+
this.client = client;
|
|
66
|
+
this.ctx = ctx;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static expiresIn(...args) {
|
|
70
|
+
const ttl = instance(provider).configuration.ttl[this.name];
|
|
71
|
+
|
|
72
|
+
if (typeof ttl === 'number') {
|
|
73
|
+
return ttl;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return ttl(...args);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
set(key, value) { this.extra[key] = value; }
|
|
80
|
+
|
|
81
|
+
async payload() {
|
|
82
|
+
const mask = new provider.Claims(this.available, { ctx: this.ctx, client: this.client });
|
|
83
|
+
|
|
84
|
+
mask.scope(this.scope);
|
|
85
|
+
mask.mask(this.mask);
|
|
86
|
+
mask.rejected(this.rejected);
|
|
87
|
+
|
|
88
|
+
return merge({}, await mask.result(), this.extra);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async issue({ use, expiresAt = null } = {}) {
|
|
92
|
+
const { client } = this;
|
|
93
|
+
const expiresIn = expiresAt ? expiresAt - epochTime() : undefined;
|
|
94
|
+
let alg;
|
|
95
|
+
|
|
96
|
+
const payload = await this.payload();
|
|
97
|
+
let signOptions;
|
|
98
|
+
let encryption;
|
|
99
|
+
|
|
100
|
+
switch (use) {
|
|
101
|
+
case 'idtoken':
|
|
102
|
+
alg = client.idTokenSignedResponseAlg;
|
|
103
|
+
signOptions = {
|
|
104
|
+
audience: client.clientId,
|
|
105
|
+
expiresIn: (expiresIn || this.constructor.expiresIn(this.ctx, this, client)),
|
|
106
|
+
issuer: provider.issuer,
|
|
107
|
+
subject: payload.sub,
|
|
108
|
+
};
|
|
109
|
+
encryption = {
|
|
110
|
+
alg: client.idTokenEncryptedResponseAlg,
|
|
111
|
+
enc: client.idTokenEncryptedResponseEnc,
|
|
112
|
+
};
|
|
113
|
+
break;
|
|
114
|
+
case 'logout':
|
|
115
|
+
alg = client.idTokenSignedResponseAlg;
|
|
116
|
+
signOptions = {
|
|
117
|
+
audience: client.clientId,
|
|
118
|
+
issuer: provider.issuer,
|
|
119
|
+
subject: payload.sub,
|
|
120
|
+
typ: 'logout+jwt',
|
|
121
|
+
expiresIn: 120,
|
|
122
|
+
};
|
|
123
|
+
encryption = {
|
|
124
|
+
alg: client.idTokenEncryptedResponseAlg,
|
|
125
|
+
enc: client.idTokenEncryptedResponseEnc,
|
|
126
|
+
};
|
|
127
|
+
break;
|
|
128
|
+
case 'userinfo':
|
|
129
|
+
alg = client.userinfoSignedResponseAlg;
|
|
130
|
+
signOptions = {
|
|
131
|
+
audience: client.clientId,
|
|
132
|
+
issuer: provider.issuer,
|
|
133
|
+
subject: payload.sub,
|
|
134
|
+
expiresIn,
|
|
135
|
+
};
|
|
136
|
+
encryption = {
|
|
137
|
+
alg: client.userinfoEncryptedResponseAlg,
|
|
138
|
+
enc: client.userinfoEncryptedResponseEnc,
|
|
139
|
+
};
|
|
140
|
+
break;
|
|
141
|
+
case 'introspection':
|
|
142
|
+
alg = client.introspectionSignedResponseAlg;
|
|
143
|
+
signOptions = {
|
|
144
|
+
audience: client.clientId,
|
|
145
|
+
issuer: provider.issuer,
|
|
146
|
+
typ: 'token-introspection+jwt',
|
|
147
|
+
};
|
|
148
|
+
encryption = {
|
|
149
|
+
alg: client.introspectionEncryptedResponseAlg,
|
|
150
|
+
enc: client.introspectionEncryptedResponseEnc,
|
|
151
|
+
};
|
|
152
|
+
break;
|
|
153
|
+
case 'authorization':
|
|
154
|
+
alg = client.authorizationSignedResponseAlg;
|
|
155
|
+
signOptions = {
|
|
156
|
+
audience: client.clientId,
|
|
157
|
+
expiresIn: 120,
|
|
158
|
+
issuer: provider.issuer,
|
|
159
|
+
noIat: true,
|
|
160
|
+
};
|
|
161
|
+
encryption = {
|
|
162
|
+
alg: client.authorizationEncryptedResponseAlg,
|
|
163
|
+
enc: client.authorizationEncryptedResponseEnc,
|
|
164
|
+
};
|
|
165
|
+
break;
|
|
166
|
+
default:
|
|
167
|
+
throw new TypeError('invalid use option');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const signed = await (async () => {
|
|
171
|
+
if (typeof alg !== 'string') {
|
|
172
|
+
throw new Error();
|
|
173
|
+
}
|
|
174
|
+
let jwk;
|
|
175
|
+
let key;
|
|
176
|
+
if (alg.startsWith('HS')) {
|
|
177
|
+
if (use !== 'authorization') { // handled in checkResponseMode
|
|
178
|
+
client.checkClientSecretExpiration(format(messages.sig[use], alg));
|
|
179
|
+
}
|
|
180
|
+
[jwk] = client.symmetricKeyStore.selectForSign({ alg, use: 'sig' });
|
|
181
|
+
key = client.symmetricKeyStore.getKeyObject(jwk);
|
|
182
|
+
} else {
|
|
183
|
+
[jwk] = instance(provider).keystore.selectForSign({ alg, use: 'sig' });
|
|
184
|
+
key = instance(provider).keystore.getKeyObject(jwk);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (use === 'idtoken') {
|
|
188
|
+
const digest = getHashArgs(alg);
|
|
189
|
+
for (const claim of hashes) {
|
|
190
|
+
if (payload[claim]) {
|
|
191
|
+
const hash = typeof digest === 'string'
|
|
192
|
+
? crypto.hash(digest, payload[claim], 'buffer')
|
|
193
|
+
: crypto.createHash(...digest).update(payload[claim]).digest();
|
|
194
|
+
payload[claim] = hash.subarray(0, hash.byteLength / 2).toString('base64url');
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (jwk) {
|
|
200
|
+
signOptions.fields = { kid: jwk.kid };
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return JWT.sign(payload, key, alg, signOptions);
|
|
204
|
+
})();
|
|
205
|
+
|
|
206
|
+
if (!encryption.enc) {
|
|
207
|
+
return signed;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (/^(A|dir$)/.test(encryption.alg)) {
|
|
211
|
+
if (use !== 'authorization') { // handled in checkResponseMode
|
|
212
|
+
client.checkClientSecretExpiration(format(messages.enc[use], encryption.alg));
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
let jwk;
|
|
217
|
+
let encryptionKey;
|
|
218
|
+
if (encryption.alg === 'dir') {
|
|
219
|
+
[jwk] = client.symmetricKeyStore.selectForEncrypt({ alg: encryption.enc, use: 'enc' });
|
|
220
|
+
jwk && (encryptionKey = client.symmetricKeyStore.getKeyObject(jwk, true));
|
|
221
|
+
} else if (encryption.alg.startsWith('A')) {
|
|
222
|
+
[jwk] = client.symmetricKeyStore.selectForEncrypt({ alg: encryption.alg, use: 'enc' });
|
|
223
|
+
jwk && (encryptionKey = client.symmetricKeyStore.getKeyObject(jwk, true));
|
|
224
|
+
} else {
|
|
225
|
+
await client.asymmetricKeyStore.refresh();
|
|
226
|
+
[jwk] = client.asymmetricKeyStore.selectForEncrypt({ alg: encryption.alg, use: 'enc' });
|
|
227
|
+
jwk && (encryptionKey = client.asymmetricKeyStore.getKeyObject(jwk, true));
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (!encryptionKey) {
|
|
231
|
+
throw new InvalidClientMetadata(`no suitable encryption key found (${encryption.alg})`);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const { kid } = jwk;
|
|
235
|
+
|
|
236
|
+
return JWT.encrypt(signed, encryptionKey, {
|
|
237
|
+
enc: encryption.enc,
|
|
238
|
+
alg: encryption.alg,
|
|
239
|
+
fields: {
|
|
240
|
+
cty: 'JWT',
|
|
241
|
+
kid,
|
|
242
|
+
iss: signOptions.issuer,
|
|
243
|
+
aud: signOptions.audience,
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
static async validate(jwt, client) {
|
|
249
|
+
const alg = client.idTokenSignedResponseAlg;
|
|
250
|
+
|
|
251
|
+
let keyOrStore;
|
|
252
|
+
if (alg.startsWith('HS')) {
|
|
253
|
+
client.checkClientSecretExpiration('client secret is expired - cannot validate ID Token Hint');
|
|
254
|
+
keyOrStore = client.symmetricKeyStore;
|
|
255
|
+
} else {
|
|
256
|
+
keyOrStore = instance(provider).keystore;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const opts = {
|
|
260
|
+
ignoreExpiration: true,
|
|
261
|
+
audience: client.clientId,
|
|
262
|
+
issuer: provider.issuer,
|
|
263
|
+
clockTolerance: instance(provider).configuration.clockTolerance,
|
|
264
|
+
algorithm: alg,
|
|
265
|
+
subject: true,
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
return JWT.verify(jwt, keyOrStore, opts);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import getAccessToken from './access_token.js';
|
|
2
|
+
import getAuthorizationCode from './authorization_code.js';
|
|
3
|
+
import getBaseModel from './base_model.js';
|
|
4
|
+
import getBaseToken from './base_token.js';
|
|
5
|
+
import getClient from './client.js';
|
|
6
|
+
import getClientCredentials from './client_credentials.js';
|
|
7
|
+
import getDeviceCode from './device_code.js';
|
|
8
|
+
import getBackchannelAuthenticationRequest from './backchannel_authentication_request.js';
|
|
9
|
+
import getIdToken from './id_token.js';
|
|
10
|
+
import getInitialAccessToken from './initial_access_token.js';
|
|
11
|
+
import getInteraction from './interaction.js';
|
|
12
|
+
import getPushedAuthorizationRequest from './pushed_authorization_request.js';
|
|
13
|
+
import getRefreshToken from './refresh_token.js';
|
|
14
|
+
import getRegistrationAccessToken from './registration_access_token.js';
|
|
15
|
+
import getReplayDetection from './replay_detection.js';
|
|
16
|
+
import getSession from './session.js';
|
|
17
|
+
import getGrant from './grant.js';
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
getAccessToken,
|
|
21
|
+
getAuthorizationCode,
|
|
22
|
+
getBackchannelAuthenticationRequest,
|
|
23
|
+
getBaseModel,
|
|
24
|
+
getBaseToken,
|
|
25
|
+
getClient,
|
|
26
|
+
getClientCredentials,
|
|
27
|
+
getDeviceCode,
|
|
28
|
+
getIdToken,
|
|
29
|
+
getInitialAccessToken,
|
|
30
|
+
getInteraction,
|
|
31
|
+
getPushedAuthorizationRequest,
|
|
32
|
+
getRefreshToken,
|
|
33
|
+
getRegistrationAccessToken,
|
|
34
|
+
getReplayDetection,
|
|
35
|
+
getSession,
|
|
36
|
+
getGrant,
|
|
37
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import apply from './mixins/apply.js';
|
|
2
|
+
import hasFormat from './mixins/has_format.js';
|
|
3
|
+
import hasPolicies from './mixins/has_policies.js';
|
|
4
|
+
|
|
5
|
+
export default (provider) => class InitialAccessToken extends apply([
|
|
6
|
+
hasPolicies(provider),
|
|
7
|
+
hasFormat(provider, 'InitialAccessToken', provider.BaseToken),
|
|
8
|
+
]) {
|
|
9
|
+
static get IN_PAYLOAD() {
|
|
10
|
+
return super.IN_PAYLOAD.filter((v) => v !== 'clientId');
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import instance from '../helpers/weak_cache.js';
|
|
2
|
+
import epochTime from '../helpers/epoch_time.js';
|
|
3
|
+
|
|
4
|
+
import hasFormat from './mixins/has_format.js';
|
|
5
|
+
|
|
6
|
+
export default (provider) => class Interaction extends hasFormat(provider, 'Interaction', instance(provider).BaseModel) {
|
|
7
|
+
constructor(jti, payload) {
|
|
8
|
+
if (arguments.length === 2) {
|
|
9
|
+
if (payload.session instanceof instance(provider).BaseModel) {
|
|
10
|
+
const { session } = payload;
|
|
11
|
+
Object.assign(payload, session.accountId ? {
|
|
12
|
+
session: {
|
|
13
|
+
accountId: session.accountId,
|
|
14
|
+
...(session.uid ? { uid: session.uid } : undefined),
|
|
15
|
+
...(session.jti ? { cookie: session.jti } : undefined),
|
|
16
|
+
...(session.acr ? { acr: session.acr } : undefined),
|
|
17
|
+
...(session.amr ? { amr: session.amr } : undefined),
|
|
18
|
+
},
|
|
19
|
+
} : { session: undefined });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (payload.grant instanceof instance(provider).BaseModel) {
|
|
23
|
+
const { grant } = payload;
|
|
24
|
+
if (grant.jti) {
|
|
25
|
+
Object.assign(payload, { grantId: grant.jti });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
super({ jti, ...payload });
|
|
30
|
+
} else {
|
|
31
|
+
super(jti);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get uid() {
|
|
36
|
+
return this.jti;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
set uid(value) {
|
|
40
|
+
this.jti = value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async save(ttl) {
|
|
44
|
+
if (typeof ttl !== 'number') {
|
|
45
|
+
throw new TypeError('"ttl" argument must be a number');
|
|
46
|
+
}
|
|
47
|
+
return super.save(ttl);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async persist() {
|
|
51
|
+
if (typeof this.exp !== 'number') {
|
|
52
|
+
throw new TypeError('persist can only be called on previously persisted Interactions');
|
|
53
|
+
}
|
|
54
|
+
return this.save(this.exp - epochTime());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static get IN_PAYLOAD() {
|
|
58
|
+
return [
|
|
59
|
+
...super.IN_PAYLOAD,
|
|
60
|
+
'session',
|
|
61
|
+
'params',
|
|
62
|
+
'prompt',
|
|
63
|
+
'result',
|
|
64
|
+
'returnTo',
|
|
65
|
+
'trusted',
|
|
66
|
+
'grantId',
|
|
67
|
+
'lastSubmission',
|
|
68
|
+
'deviceCode',
|
|
69
|
+
'cid',
|
|
70
|
+
'parJti',
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export default (superclass) => class extends superclass {
|
|
2
|
+
static get IN_PAYLOAD() {
|
|
3
|
+
return [
|
|
4
|
+
...super.IN_PAYLOAD,
|
|
5
|
+
'consumed',
|
|
6
|
+
];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
async consume() {
|
|
10
|
+
await this.adapter.consume(this.jti);
|
|
11
|
+
this.emit('consumed');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get isValid() {
|
|
15
|
+
return !this.consumed && !this.isExpired;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import instance from '../../helpers/weak_cache.js';
|
|
2
|
+
import formatsGenerator from '../formats/index.js';
|
|
3
|
+
|
|
4
|
+
const DEFAULT = 'opaque';
|
|
5
|
+
|
|
6
|
+
function AccessTokenFormat(ctx, token) {
|
|
7
|
+
return token.resourceServer?.accessTokenFormat ?? 'opaque';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default (provider, type, superclass) => {
|
|
11
|
+
const formats = formatsGenerator(provider);
|
|
12
|
+
|
|
13
|
+
let FORMAT;
|
|
14
|
+
if (type === 'AccessToken' || type === 'ClientCredentials') {
|
|
15
|
+
FORMAT = AccessTokenFormat;
|
|
16
|
+
} else {
|
|
17
|
+
FORMAT = DEFAULT;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (FORMAT !== DEFAULT || type === 'base') {
|
|
21
|
+
const dynamic = typeof FORMAT === 'function';
|
|
22
|
+
if (!dynamic) {
|
|
23
|
+
if (!formats[FORMAT]) throw new TypeError(`unsupported format specified (${FORMAT})`);
|
|
24
|
+
if (FORMAT === 'dynamic') throw new TypeError('dynamic format must be configured as a function');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
generateTokenId,
|
|
29
|
+
getValueAndPayload,
|
|
30
|
+
} = formats[dynamic ? 'dynamic' : FORMAT];
|
|
31
|
+
|
|
32
|
+
const klass = class extends superclass {};
|
|
33
|
+
klass.prototype.generateTokenId = generateTokenId;
|
|
34
|
+
klass.prototype.getValueAndPayload = getValueAndPayload;
|
|
35
|
+
klass.prototype.constructor.verify = formats.opaque.verify;
|
|
36
|
+
|
|
37
|
+
if (dynamic) {
|
|
38
|
+
instance(provider).dynamic ||= {};
|
|
39
|
+
instance(provider).dynamic[type] = FORMAT;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return klass;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return superclass;
|
|
46
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import instance from '../../helpers/weak_cache.js';
|
|
2
|
+
|
|
3
|
+
function validate(provider, policies) {
|
|
4
|
+
if (!Array.isArray(policies)) {
|
|
5
|
+
throw new TypeError('policies must be an array');
|
|
6
|
+
}
|
|
7
|
+
if (!policies.length) {
|
|
8
|
+
throw new TypeError('policies must not be empty');
|
|
9
|
+
}
|
|
10
|
+
policies.forEach((policy) => {
|
|
11
|
+
if (typeof policy !== 'string') {
|
|
12
|
+
throw new TypeError('policies must be strings');
|
|
13
|
+
}
|
|
14
|
+
if (!instance(provider).features.registration.policies[policy]) {
|
|
15
|
+
throw new TypeError(`policy ${policy} not configured`);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default (provider) => (superclass) => class extends superclass {
|
|
21
|
+
async save() {
|
|
22
|
+
if (typeof this.policies !== 'undefined') validate(provider, this.policies);
|
|
23
|
+
return super.save();
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static async find(...args) {
|
|
27
|
+
const result = await super.find(...args);
|
|
28
|
+
if (result && typeof result.policies !== 'undefined') validate(provider, result.policies);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static get IN_PAYLOAD() {
|
|
33
|
+
return [
|
|
34
|
+
...super.IN_PAYLOAD,
|
|
35
|
+
'policies',
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as jose from 'jose';
|
|
2
|
+
|
|
3
|
+
export default (superclass) => class extends superclass {
|
|
4
|
+
static get IN_PAYLOAD() {
|
|
5
|
+
return [
|
|
6
|
+
...super.IN_PAYLOAD,
|
|
7
|
+
'attestationJkt',
|
|
8
|
+
];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async setAttestBinding(ctx) {
|
|
12
|
+
const { cnf: { jwk } } = jose.decodeJwt(ctx.get('oauth-client-attestation'));
|
|
13
|
+
this.attestationJkt = await jose.calculateJwkThumbprint(jwk);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { InvalidRequest } from '../../helpers/errors.js';
|
|
2
|
+
import certificateThumbprint from '../../helpers/certificate_thumbprint.js';
|
|
3
|
+
|
|
4
|
+
const x5t = 'x5t#S256';
|
|
5
|
+
const jkt = 'jkt';
|
|
6
|
+
|
|
7
|
+
export default (superclass) => class extends superclass {
|
|
8
|
+
static get IN_PAYLOAD() {
|
|
9
|
+
return [
|
|
10
|
+
...super.IN_PAYLOAD,
|
|
11
|
+
x5t,
|
|
12
|
+
jkt,
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
setThumbprint(prop, input) {
|
|
17
|
+
switch (prop) {
|
|
18
|
+
case 'x5t':
|
|
19
|
+
if (this[jkt]) {
|
|
20
|
+
throw new InvalidRequest('multiple proof-of-posession mechanisms are not allowed');
|
|
21
|
+
}
|
|
22
|
+
this[x5t] = certificateThumbprint(input);
|
|
23
|
+
break;
|
|
24
|
+
case 'jkt':
|
|
25
|
+
if (this[x5t]) {
|
|
26
|
+
throw new InvalidRequest('multiple proof-of-posession mechanisms are not allowed');
|
|
27
|
+
}
|
|
28
|
+
this[jkt] = input;
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
throw new Error('unsupported');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
isSenderConstrained() {
|
|
36
|
+
if (this[jkt] || this[x5t]) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get tokenType() {
|
|
44
|
+
if (this[jkt]) {
|
|
45
|
+
return 'DPoP';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return 'Bearer';
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export default (provider) => (superclass) => class extends superclass {
|
|
2
|
+
static get IN_PAYLOAD() {
|
|
3
|
+
return [
|
|
4
|
+
...super.IN_PAYLOAD,
|
|
5
|
+
'sessionUid',
|
|
6
|
+
'expiresWithSession',
|
|
7
|
+
];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static async find(...args) {
|
|
11
|
+
const token = await super.find(...args);
|
|
12
|
+
|
|
13
|
+
const ignoreSessionBinding = args[1] && args[1].ignoreSessionBinding === true;
|
|
14
|
+
|
|
15
|
+
if (!token?.expiresWithSession || ignoreSessionBinding) {
|
|
16
|
+
return token;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const session = await provider.Session.findByUid(token.sessionUid);
|
|
20
|
+
|
|
21
|
+
// related session was not found
|
|
22
|
+
if (!session) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// token and session principal are now different
|
|
27
|
+
if (token.accountId !== session.accountId) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// token and session grantId are now different
|
|
32
|
+
if (token.grantId !== session.grantIdFor(token.clientId)) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return token;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { InvalidTarget } from '../../helpers/errors.js';
|
|
2
|
+
|
|
3
|
+
export default (superclass) => class extends superclass {
|
|
4
|
+
setAudience(audience) {
|
|
5
|
+
if (Array.isArray(audience)) {
|
|
6
|
+
if (audience.length === 0) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (audience.length > 1) {
|
|
10
|
+
throw new InvalidTarget('only a single audience value is supported');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// eslint-disable-next-line no-param-reassign
|
|
14
|
+
[audience] = audience;
|
|
15
|
+
} else if (typeof audience !== 'string' || !audience) {
|
|
16
|
+
throw new InvalidTarget();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
this.aud = audience;
|
|
20
|
+
}
|
|
21
|
+
};
|