@udibo/oauth2 0.14.0 → 0.15.0
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/README.md +45 -24
- package/{esm → dist}/adapters/hono/_common.d.ts +5 -5
- package/{esm → dist}/adapters/hono/_common.js +1 -1
- package/{esm → dist}/adapters/hono/authorization-server.d.ts +6 -7
- package/{esm → dist}/adapters/hono/authorization-server.js +0 -1
- package/{esm → dist}/adapters/hono/bff/auth-request-store.d.ts +2 -2
- package/{esm → dist}/adapters/hono/bff/auth-request-store.js +2 -2
- package/{esm → dist}/adapters/hono/bff/bff.d.ts +22 -12
- package/{esm → dist}/adapters/hono/bff/bff.js +35 -29
- package/{esm → dist}/adapters/hono/bff/cookie-prefix.js +1 -2
- package/{esm → dist}/adapters/hono/bff/mod.d.ts +5 -6
- package/{esm → dist}/adapters/hono/bff/mod.js +1 -2
- package/{esm → dist}/adapters/hono/bff/proxy.js +2 -1
- package/{esm → dist}/adapters/hono/bff/session-store.d.ts +2 -2
- package/{esm → dist}/adapters/hono/bff/session-store.js +7 -6
- package/{esm → dist}/adapters/hono/bff/testing.d.ts +7 -8
- package/{esm → dist}/adapters/hono/bff/testing.js +19 -22
- package/{esm → dist}/adapters/hono/identity.d.ts +1 -2
- package/{esm → dist}/adapters/hono/identity.js +10 -10
- package/{esm → dist}/adapters/hono/log.d.ts +0 -1
- package/{esm → dist}/adapters/hono/log.js +0 -6
- package/{esm → dist}/adapters/hono/resource-server.d.ts +5 -6
- package/{esm → dist}/adapters/hono/resource-server.js +0 -1
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +3 -0
- package/dist/cli/idp/config.d.ts +110 -0
- package/dist/cli/idp/config.js +269 -0
- package/dist/cli/idp/mod.d.ts +20 -0
- package/dist/cli/idp/mod.js +175 -0
- package/dist/cli/idp/pages.d.ts +56 -0
- package/dist/cli/idp/pages.js +190 -0
- package/dist/cli/idp/server.d.ts +93 -0
- package/dist/cli/idp/server.js +559 -0
- package/dist/cli/keygen.d.ts +13 -0
- package/dist/cli/keygen.js +30 -0
- package/dist/cli/mod.d.ts +34 -0
- package/dist/cli/mod.js +94 -0
- package/{esm → dist}/client/_http.d.ts +1 -1
- package/{esm → dist}/client/base.d.ts +1 -1
- package/{esm → dist}/client/bff-client.d.ts +1 -1
- package/{esm → dist}/client/bff-client.js +7 -6
- package/{esm → dist}/client/browser-storage.d.ts +1 -1
- package/{esm → dist}/client/check.js +1 -1
- package/{esm → dist}/client/direct-client.d.ts +6 -6
- package/{esm → dist}/client/direct-client.js +11 -13
- package/{esm → dist}/client/discovery-cache.d.ts +1 -1
- package/{esm → dist}/client/discovery-cache.js +2 -2
- package/{esm → dist}/client/events.d.ts +1 -1
- package/{esm → dist}/client/mod.d.ts +11 -12
- package/{esm → dist}/client/mod.js +1 -1
- package/{esm → dist}/errors.d.ts +1 -1
- package/{esm → dist}/errors.js +1 -1
- package/{esm → dist}/identity/events.d.ts +1 -1
- package/{esm → dist}/identity/external/_shared.d.ts +1 -1
- package/{esm → dist}/identity/external/_shared.js +1 -2
- package/{esm → dist}/identity/external/apple-client-secret.d.ts +1 -1
- package/{esm → dist}/identity/external/apple-client-secret.js +6 -7
- package/{esm → dist}/identity/external/apple.d.ts +5 -5
- package/{esm → dist}/identity/external/apple.js +10 -11
- package/{esm → dist}/identity/external/discord.d.ts +3 -3
- package/{esm → dist}/identity/external/discord.js +2 -2
- package/{esm → dist}/identity/external/flow.d.ts +1 -1
- package/{esm → dist}/identity/external/flow.js +2 -2
- package/{esm → dist}/identity/external/github.d.ts +3 -3
- package/{esm → dist}/identity/external/github.js +12 -17
- package/{esm → dist}/identity/external/google.d.ts +5 -5
- package/{esm → dist}/identity/external/google.js +2 -2
- package/{esm → dist}/identity/external/mod.d.ts +12 -13
- package/{esm → dist}/identity/external/mod.js +0 -1
- package/{esm → dist}/identity/external/oauth2.d.ts +1 -1
- package/{esm → dist}/identity/external/oauth2.js +8 -8
- package/{esm → dist}/identity/external/oidc.d.ts +4 -4
- package/{esm → dist}/identity/external/oidc.js +9 -8
- package/{esm → dist}/identity/hibp.d.ts +1 -1
- package/{esm → dist}/identity/hibp.js +1 -1
- package/{esm → dist}/identity/lockout.js +1 -2
- package/{esm → dist}/identity/mfa/mod.d.ts +4 -5
- package/{esm → dist}/identity/mfa/mod.js +1 -2
- package/{esm → dist}/identity/mfa/service.d.ts +3 -3
- package/{esm → dist}/identity/mfa/service.js +4 -3
- package/{esm → dist}/identity/mfa/totp.d.ts +1 -1
- package/{esm → dist}/identity/mfa/totp.js +2 -2
- package/{esm → dist}/identity/migration.d.ts +2 -3
- package/{esm → dist}/identity/migration.js +3 -4
- package/{esm → dist}/identity/mod.d.ts +14 -15
- package/{esm → dist}/identity/mod.js +0 -1
- package/{esm → dist}/identity/otp.d.ts +1 -1
- package/{esm → dist}/identity/otp.js +4 -2
- package/{esm → dist}/identity/password.js +8 -5
- package/{esm → dist}/identity/rate-limit.d.ts +1 -1
- package/{esm → dist}/identity/service.d.ts +10 -10
- package/{esm → dist}/identity/service.js +17 -18
- package/{esm → dist}/identity/session.js +2 -2
- package/{esm → dist}/identity/token-flow.js +3 -2
- package/{esm → dist}/models/authorization-code.d.ts +3 -3
- package/{esm → dist}/models/authorization.d.ts +1 -1
- package/{esm → dist}/models/authorization.js +1 -2
- package/{esm → dist}/models/device-authorization.d.ts +2 -2
- package/{esm → dist}/models/token.d.ts +3 -3
- package/{esm → dist}/react/callback.d.ts +1 -1
- package/{esm → dist}/react/callback.js +0 -1
- package/{esm → dist}/react/components/class-names.d.ts +1 -1
- package/{esm → dist}/react/components/class-names.js +3 -2
- package/{esm → dist}/react/components/internal.d.ts +2 -2
- package/{esm → dist}/react/components/internal.js +5 -11
- package/{esm → dist}/react/components/mfa-challenge-form.d.ts +2 -2
- package/{esm → dist}/react/components/mfa-challenge-form.js +4 -6
- package/{esm → dist}/react/components/mfa-enrollment-form.d.ts +2 -2
- package/{esm → dist}/react/components/mfa-enrollment-form.js +2 -6
- package/{esm → dist}/react/components/mod.d.ts +20 -21
- package/{esm → dist}/react/components/mod.js +1 -2
- package/{esm → dist}/react/components/request-password-reset-form.d.ts +2 -2
- package/{esm → dist}/react/components/request-password-reset-form.js +1 -3
- package/{esm → dist}/react/components/reset-password-form.d.ts +2 -2
- package/{esm → dist}/react/components/reset-password-form.js +2 -2
- package/{esm → dist}/react/components/sign-in-form.d.ts +2 -2
- package/{esm → dist}/react/components/sign-in-form.js +1 -5
- package/{esm → dist}/react/components/sign-up-form.d.ts +2 -2
- package/{esm → dist}/react/components/sign-up-form.js +4 -10
- package/{esm → dist}/react/components/types.d.ts +2 -2
- package/{esm → dist}/react/components/use-auth-form.d.ts +3 -3
- package/{esm → dist}/react/components/use-auth-form.js +4 -7
- package/{esm → dist}/react/components/user-menu.d.ts +2 -2
- package/{esm → dist}/react/components/user-menu.js +9 -14
- package/{esm → dist}/react/context.d.ts +1 -1
- package/{esm → dist}/react/mod.d.ts +6 -7
- package/{esm → dist}/react/mod.js +0 -1
- package/{esm → dist}/react/provider.d.ts +2 -2
- package/{esm → dist}/react/require-auth.js +1 -3
- package/{esm → dist}/react/testing.d.ts +2 -3
- package/{esm → dist}/react/testing.js +1 -2
- package/{esm → dist}/react/use-authorization.d.ts +1 -1
- package/{esm → dist}/react/use-oauth2.d.ts +8 -1
- package/{esm → dist}/react/use-oauth2.js +0 -1
- package/{esm → dist}/server/_clock-skew.js +2 -1
- package/{esm → dist}/server/authorization-server.d.ts +40 -41
- package/{esm → dist}/server/authorization-server.js +32 -42
- package/{esm → dist}/server/client-authentication.d.ts +2 -2
- package/{esm → dist}/server/grants/authorization-code.d.ts +9 -9
- package/{esm → dist}/server/grants/authorization-code.js +5 -6
- package/{esm → dist}/server/grants/client-credentials.d.ts +4 -4
- package/{esm → dist}/server/grants/device-authorization.d.ts +6 -6
- package/{esm → dist}/server/grants/device-authorization.js +4 -4
- package/{esm → dist}/server/grants/grant.d.ts +7 -7
- package/{esm → dist}/server/grants/grant.js +7 -7
- package/{esm → dist}/server/grants/password.d.ts +5 -5
- package/{esm → dist}/server/grants/refresh-token.d.ts +4 -4
- package/{esm → dist}/server/grants/refresh-token.js +5 -6
- package/{esm → dist}/server/introspection-token-reader.d.ts +5 -5
- package/{esm → dist}/server/introspection-token-reader.js +4 -4
- package/{esm → dist}/server/jwks-token-reader.d.ts +5 -5
- package/{esm → dist}/server/jwks-token-reader.js +4 -4
- package/{esm → dist}/server/mod.d.ts +12 -13
- package/{esm → dist}/server/mod.js +0 -1
- package/{esm → dist}/server/public-suffix/mod.d.ts +2 -3
- package/{esm → dist}/server/public-suffix/mod.js +1 -2
- package/{esm → dist}/server/public-suffix/rules.d.ts +1 -1
- package/{esm → dist}/server/public-suffix/rules.js +1 -1
- package/{esm → dist}/server/redirect-uri.js +5 -4
- package/{esm → dist}/server/resource-server.d.ts +11 -12
- package/{esm → dist}/server/resource-server.js +12 -14
- package/{esm → dist}/server/services/authorization-code.d.ts +5 -5
- package/{esm → dist}/server/services/client.d.ts +1 -1
- package/{esm → dist}/server/services/device-authorization.d.ts +3 -3
- package/{esm → dist}/server/services/token.d.ts +6 -6
- package/{esm → dist}/server/services/token.js +3 -1
- package/{esm → dist}/server/services/user.d.ts +1 -1
- package/{esm → dist}/server/signing-keys.d.ts +1 -1
- package/{esm → dist}/server/signing-keys.js +8 -2
- package/{esm → dist}/server/utils/hash.js +1 -1
- package/{esm → dist}/testing/contract/auth-request-storage.d.ts +1 -1
- package/{esm → dist}/testing/contract/auth-request-storage.js +24 -29
- package/{esm → dist}/testing/contract/authorization-code.d.ts +6 -6
- package/{esm → dist}/testing/contract/authorization-code.js +16 -17
- package/{esm → dist}/testing/contract/client.d.ts +4 -4
- package/{esm → dist}/testing/contract/client.js +14 -15
- package/{esm → dist}/testing/contract/device-authorization.d.ts +6 -6
- package/{esm → dist}/testing/contract/device-authorization.js +37 -39
- package/{esm → dist}/testing/contract/identity-session.d.ts +6 -1
- package/{esm → dist}/testing/contract/identity-session.js +44 -36
- package/{esm → dist}/testing/contract/identity-user-store.d.ts +8 -2
- package/{esm → dist}/testing/contract/identity-user-store.js +48 -46
- package/{esm → dist}/testing/contract/lockout-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/lockout-store.js +23 -24
- package/{esm → dist}/testing/contract/mfa-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/mfa-store.js +53 -54
- package/{esm → dist}/testing/contract/mod.d.ts +15 -16
- package/{esm → dist}/testing/contract/mod.js +0 -1
- package/{esm → dist}/testing/contract/otp-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/otp-store.js +33 -34
- package/{esm → dist}/testing/contract/rate-limit-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/rate-limit-store.js +15 -16
- package/{esm → dist}/testing/contract/tenant.js +361 -330
- package/{esm → dist}/testing/contract/token-flow-store.d.ts +1 -1
- package/{esm → dist}/testing/contract/token-flow-store.js +27 -32
- package/{esm → dist}/testing/contract/token-reader.d.ts +3 -3
- package/{esm → dist}/testing/contract/token-reader.js +6 -7
- package/{esm → dist}/testing/contract/token.d.ts +7 -7
- package/{esm → dist}/testing/contract/token.js +48 -53
- package/{esm → dist}/testing/contract/user.d.ts +2 -2
- package/{esm → dist}/testing/contract/user.js +8 -9
- package/{esm → dist}/testing/mod.d.ts +5 -6
- package/{esm → dist}/testing/mod.js +2 -3
- package/{esm → dist}/testing/server.d.ts +7 -6
- package/{esm → dist}/testing/server.js +2 -1
- package/{esm → dist}/testing/services.d.ts +11 -11
- package/{esm → dist}/testing/services.js +8 -8
- package/{esm → dist}/testing/tenant.d.ts +11 -7
- package/{esm → dist}/testing/tenant.js +109 -94
- package/dist/utils/_constant-time.d.ts +12 -0
- package/dist/utils/_constant-time.js +19 -0
- package/{esm → dist}/utils/_default-fetch.js +4 -1
- package/dist/utils/_delay.d.ts +13 -0
- package/dist/utils/_delay.js +28 -0
- package/dist/utils/_encoding.d.ts +39 -0
- package/dist/utils/_encoding.js +126 -0
- package/{esm → dist}/utils/authentication-context.d.ts +1 -1
- package/{esm → dist}/utils/crypto.d.ts +2 -3
- package/{esm → dist}/utils/crypto.js +3 -4
- package/{esm → dist}/utils/pkce.js +1 -1
- package/{esm → dist}/utils/text.js +1 -1
- package/{esm → dist}/utils/url.d.ts +0 -1
- package/{esm → dist}/utils/url.js +0 -1
- package/package.json +156 -33
- package/esm/_dnt.polyfills.d.ts +0 -31
- package/esm/_dnt.polyfills.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +0 -47
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +0 -65
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +0 -16
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +0 -25
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +0 -30
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +0 -24
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +0 -193
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +0 -36
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +0 -61
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +0 -27
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +0 -20
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +0 -52
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +0 -24
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +0 -18
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +0 -43
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +0 -45
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +0 -39
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +0 -19
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +0 -29
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +0 -22
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +0 -32
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +0 -28
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +0 -177
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +0 -41
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +0 -53
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +0 -23
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +0 -58
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +0 -17
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +0 -26
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +0 -44
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +0 -44
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +0 -20
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +0 -14
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +0 -20
- package/esm/deps/jsr.io/@std/async/1.5.0/delay.d.ts +0 -44
- package/esm/deps/jsr.io/@std/async/1.5.0/delay.js +0 -84
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.d.ts +0 -39
- package/esm/deps/jsr.io/@std/crypto/1.1.0/timing_safe_equal.js +0 -61
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.d.ts +0 -22
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common16.js +0 -51
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.d.ts +0 -34
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common32.js +0 -192
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.d.ts +0 -34
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common64.js +0 -113
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.d.ts +0 -3
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_common_detach.js +0 -13
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.d.ts +0 -8
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_types.js +0 -2
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.d.ts +0 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.11/_validate_binary_like.js +0 -26
- package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.d.ts +0 -60
- package/esm/deps/jsr.io/@std/encoding/1.0.11/ascii85.js +0 -152
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base32.js +0 -87
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base58.js +0 -131
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64.js +0 -82
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.d.ts +0 -39
- package/esm/deps/jsr.io/@std/encoding/1.0.11/base64url.js +0 -72
- package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.d.ts +0 -38
- package/esm/deps/jsr.io/@std/encoding/1.0.11/hex.js +0 -87
- package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.d.ts +0 -97
- package/esm/deps/jsr.io/@std/encoding/1.0.11/mod.js +0 -99
- package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.d.ts +0 -119
- package/esm/deps/jsr.io/@std/encoding/1.0.11/varint.js +0 -209
- package/esm/deps/jsr.io/@std/http/1.1.3/status.d.ts +0 -343
- package/esm/deps/jsr.io/@std/http/1.1.3/status.js +0 -343
- package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.d.ts +0 -159
- package/esm/deps/jsr.io/@std/internal/1.0.14/assertion_state.js +0 -223
- package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.d.ts +0 -79
- package/esm/deps/jsr.io/@std/internal/1.0.14/build_message.js +0 -116
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff.d.ts +0 -139
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff.js +0 -277
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.d.ts +0 -98
- package/esm/deps/jsr.io/@std/internal/1.0.14/diff_str.js +0 -181
- package/esm/deps/jsr.io/@std/internal/1.0.14/format.d.ts +0 -29
- package/esm/deps/jsr.io/@std/internal/1.0.14/format.js +0 -68
- package/esm/deps/jsr.io/@std/internal/1.0.14/styles.d.ts +0 -158
- package/esm/deps/jsr.io/@std/internal/1.0.14/styles.js +0 -206
- package/esm/deps/jsr.io/@std/internal/1.0.14/types.d.ts +0 -24
- package/esm/deps/jsr.io/@std/internal/1.0.14/types.js +0 -3
- package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.d.ts +0 -91
- package/esm/deps/jsr.io/@std/testing/1.0.20/_test_suite.js +0 -347
- package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.d.ts +0 -382
- package/esm/deps/jsr.io/@std/testing/1.0.20/bdd.js +0 -1110
- package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.d.ts +0 -363
- package/esm/deps/jsr.io/@udibo/http-error/0.11.1/mod.js +0 -616
- package/esm/package.json +0 -3
- /package/{esm → dist}/adapters/hono/bff/cookie-prefix.d.ts +0 -0
- /package/{esm → dist}/adapters/hono/bff/proxy.d.ts +0 -0
- /package/{esm → dist}/client/_http.js +0 -0
- /package/{esm → dist}/client/base.js +0 -0
- /package/{esm → dist}/client/browser-storage.js +0 -0
- /package/{esm → dist}/client/check.d.ts +0 -0
- /package/{esm → dist}/client/events.js +0 -0
- /package/{esm → dist}/client/storage.d.ts +0 -0
- /package/{esm → dist}/client/storage.js +0 -0
- /package/{esm → dist}/identity/captcha.d.ts +0 -0
- /package/{esm → dist}/identity/captcha.js +0 -0
- /package/{esm → dist}/identity/delivery.d.ts +0 -0
- /package/{esm → dist}/identity/delivery.js +0 -0
- /package/{esm → dist}/identity/errors.d.ts +0 -0
- /package/{esm → dist}/identity/errors.js +0 -0
- /package/{esm → dist}/identity/events.js +0 -0
- /package/{esm → dist}/identity/external/_token-exchange.d.ts +0 -0
- /package/{esm → dist}/identity/external/_token-exchange.js +0 -0
- /package/{esm → dist}/identity/external/errors.d.ts +0 -0
- /package/{esm → dist}/identity/external/errors.js +0 -0
- /package/{esm → dist}/identity/external/provider.d.ts +0 -0
- /package/{esm → dist}/identity/external/provider.js +0 -0
- /package/{esm → dist}/identity/identifier.d.ts +0 -0
- /package/{esm → dist}/identity/identifier.js +0 -0
- /package/{esm → dist}/identity/lockout.d.ts +0 -0
- /package/{esm → dist}/identity/mfa/recovery-codes.d.ts +0 -0
- /package/{esm → dist}/identity/mfa/recovery-codes.js +0 -0
- /package/{esm → dist}/identity/password-policy.d.ts +0 -0
- /package/{esm → dist}/identity/password-policy.js +0 -0
- /package/{esm → dist}/identity/password.d.ts +0 -0
- /package/{esm → dist}/identity/rate-limit.js +0 -0
- /package/{esm → dist}/identity/session.d.ts +0 -0
- /package/{esm → dist}/identity/token-flow.d.ts +0 -0
- /package/{esm → dist}/models/authentication.d.ts +0 -0
- /package/{esm → dist}/models/authentication.js +0 -0
- /package/{esm → dist}/models/authorization-code.js +0 -0
- /package/{esm → dist}/models/client.d.ts +0 -0
- /package/{esm → dist}/models/client.js +0 -0
- /package/{esm → dist}/models/device-authorization.js +0 -0
- /package/{esm → dist}/models/responses.d.ts +0 -0
- /package/{esm → dist}/models/responses.js +0 -0
- /package/{esm → dist}/models/scope.d.ts +0 -0
- /package/{esm → dist}/models/scope.js +0 -0
- /package/{esm → dist}/models/token.js +0 -0
- /package/{esm → dist}/react/components/types.js +0 -0
- /package/{esm → dist}/react/context.js +0 -0
- /package/{esm → dist}/react/provider.js +0 -0
- /package/{esm → dist}/react/require-auth.d.ts +0 -0
- /package/{esm → dist}/react/use-authorization.js +0 -0
- /package/{esm → dist}/server/_clock-skew.d.ts +0 -0
- /package/{esm → dist}/server/client-authentication.js +0 -0
- /package/{esm → dist}/server/grants/client-credentials.js +0 -0
- /package/{esm → dist}/server/grants/password.js +0 -0
- /package/{esm → dist}/server/redirect-uri.d.ts +0 -0
- /package/{esm → dist}/server/services/authorization-code.js +0 -0
- /package/{esm → dist}/server/services/client.js +0 -0
- /package/{esm → dist}/server/services/device-authorization.js +0 -0
- /package/{esm → dist}/server/services/user.js +0 -0
- /package/{esm → dist}/server/utils/hash.d.ts +0 -0
- /package/{esm → dist}/testing/contract/_race.d.ts +0 -0
- /package/{esm → dist}/testing/contract/_race.js +0 -0
- /package/{esm → dist}/testing/contract/tenant.d.ts +0 -0
- /package/{esm → dist}/utils/_body.d.ts +0 -0
- /package/{esm → dist}/utils/_body.js +0 -0
- /package/{esm → dist}/utils/_buffer.d.ts +0 -0
- /package/{esm → dist}/utils/_buffer.js +0 -0
- /package/{esm → dist}/utils/_default-fetch.d.ts +0 -0
- /package/{esm → dist}/utils/_timing-safe.d.ts +0 -0
- /package/{esm → dist}/utils/_timing-safe.js +0 -0
- /package/{esm → dist}/utils/authentication-context.js +0 -0
- /package/{esm → dist}/utils/basic-auth.d.ts +0 -0
- /package/{esm → dist}/utils/basic-auth.js +0 -0
- /package/{esm → dist}/utils/pkce.d.ts +0 -0
- /package/{esm → dist}/utils/text.d.ts +0 -0
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
* @see https://datatracker.ietf.org/doc/html/rfc8628
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
import type { ClientInterface } from "../../models/client.
|
|
12
|
-
import type { Token } from "../../models/token.
|
|
13
|
-
import type { AbstractScope, BasicScope } from "../../models/scope.
|
|
14
|
-
import type { DeviceAuthorization } from "../../models/device-authorization.
|
|
15
|
-
import type { DeviceAuthorizationServiceInterface } from "../services/device-authorization.
|
|
16
|
-
import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.
|
|
11
|
+
import type { ClientInterface } from "../../models/client.ts";
|
|
12
|
+
import type { Token } from "../../models/token.ts";
|
|
13
|
+
import type { AbstractScope, BasicScope } from "../../models/scope.ts";
|
|
14
|
+
import type { DeviceAuthorization } from "../../models/device-authorization.ts";
|
|
15
|
+
import type { DeviceAuthorizationServiceInterface } from "../services/device-authorization.ts";
|
|
16
|
+
import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.ts";
|
|
17
17
|
/**
|
|
18
18
|
* Services required by the device authorization grant.
|
|
19
19
|
*/
|
|
@@ -95,8 +95,7 @@ export class DeviceAuthorizationGrant extends AbstractGrant {
|
|
|
95
95
|
* @see https://datatracker.ietf.org/doc/html/rfc8628#section-3.5
|
|
96
96
|
*/
|
|
97
97
|
async token(request, client, body) {
|
|
98
|
-
const { deviceAuthorizationService, tokenService } = await this
|
|
99
|
-
.resolveServices(request);
|
|
98
|
+
const { deviceAuthorizationService, tokenService } = await this.resolveServices(request);
|
|
100
99
|
const deviceCode = body.get("device_code");
|
|
101
100
|
if (typeof deviceCode !== "string") {
|
|
102
101
|
throw new InvalidRequestError("device_code parameter required");
|
|
@@ -130,7 +129,7 @@ export class DeviceAuthorizationGrant extends AbstractGrant {
|
|
|
130
129
|
throw new AuthorizationPendingError("authorization request is pending user approval");
|
|
131
130
|
}
|
|
132
131
|
const { user, scope } = authorization;
|
|
133
|
-
if (!await deviceAuthorizationService.revoke(authorization)) {
|
|
132
|
+
if (!(await deviceAuthorizationService.revoke(authorization))) {
|
|
134
133
|
throw new InvalidGrantError("device_code already used");
|
|
135
134
|
}
|
|
136
135
|
const token = await this.generateToken(client, user, scope, tokenService);
|
|
@@ -143,7 +142,8 @@ export class DeviceAuthorizationGrant extends AbstractGrant {
|
|
|
143
142
|
catch (error) {
|
|
144
143
|
let stillStored;
|
|
145
144
|
try {
|
|
146
|
-
stillStored =
|
|
145
|
+
stillStored =
|
|
146
|
+
await deviceAuthorizationService.getByDeviceCode(deviceCode);
|
|
147
147
|
}
|
|
148
148
|
catch {
|
|
149
149
|
throw error;
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4
|
|
17
17
|
* @module
|
|
18
18
|
*/
|
|
19
|
-
import type { ClientCredentials, ClientInterface } from "../../models/client.
|
|
20
|
-
import type { RefreshToken, Token } from "../../models/token.
|
|
21
|
-
import type { AuthenticationContext } from "../../models/authentication.
|
|
22
|
-
import type { AbstractScope, ScopeConstructor } from "../../models/scope.
|
|
23
|
-
import { BasicScope } from "../../models/scope.
|
|
24
|
-
import type { ClientServiceInterface } from "../services/client.
|
|
25
|
-
import type { TokenServiceInterface } from "../services/token.
|
|
19
|
+
import type { ClientCredentials, ClientInterface } from "../../models/client.ts";
|
|
20
|
+
import type { RefreshToken, Token } from "../../models/token.ts";
|
|
21
|
+
import type { AuthenticationContext } from "../../models/authentication.ts";
|
|
22
|
+
import type { AbstractScope, ScopeConstructor } from "../../models/scope.ts";
|
|
23
|
+
import { BasicScope } from "../../models/scope.ts";
|
|
24
|
+
import type { ClientServiceInterface } from "../services/client.ts";
|
|
25
|
+
import type { TokenServiceInterface } from "../services/token.ts";
|
|
26
26
|
/**
|
|
27
27
|
* The core services every grant needs: client lookup/authentication and token
|
|
28
28
|
* storage. Each grant defines its own services interface by extending this with
|
|
@@ -38,8 +38,8 @@ export class AbstractGrant {
|
|
|
38
38
|
/** Creates a grant from the shared {@linkcode GrantOptions}. */
|
|
39
39
|
constructor(options) {
|
|
40
40
|
this.allowRefreshToken = options.allowRefreshToken ?? false;
|
|
41
|
-
this.Scope =
|
|
42
|
-
BasicScope;
|
|
41
|
+
this.Scope =
|
|
42
|
+
options.Scope ?? BasicScope;
|
|
43
43
|
this.#resolve = options.resolve;
|
|
44
44
|
}
|
|
45
45
|
/** The services this grant needs for `request`, from its `resolve` option. */
|
|
@@ -148,12 +148,12 @@ export class AbstractGrant {
|
|
|
148
148
|
if (refreshTokenExpiresAt) {
|
|
149
149
|
withRefresh.refreshTokenExpiresAt = refreshTokenExpiresAt;
|
|
150
150
|
}
|
|
151
|
-
const newFamilyExpiresAt = await tokenService
|
|
152
|
-
.refreshTokenFamilyExpiresAt?.(client, user, familyCreatedAt, scope);
|
|
151
|
+
const newFamilyExpiresAt = await tokenService.refreshTokenFamilyExpiresAt?.(client, user, familyCreatedAt, scope);
|
|
153
152
|
if (newFamilyExpiresAt) {
|
|
154
|
-
ceiling =
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
ceiling =
|
|
154
|
+
ceiling && ceiling < newFamilyExpiresAt
|
|
155
|
+
? ceiling
|
|
156
|
+
: newFamilyExpiresAt;
|
|
157
157
|
}
|
|
158
158
|
result = withRefresh;
|
|
159
159
|
}
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
* @see https://datatracker.ietf.org/doc/html/draft-ietf-oauth-security-topics#section-2.4
|
|
18
18
|
* @module
|
|
19
19
|
*/
|
|
20
|
-
import type { ClientInterface } from "../../models/client.
|
|
21
|
-
import type { Token } from "../../models/token.
|
|
22
|
-
import type { AbstractScope, BasicScope } from "../../models/scope.
|
|
23
|
-
import type { UserServiceInterface } from "../services/user.
|
|
24
|
-
import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.
|
|
20
|
+
import type { ClientInterface } from "../../models/client.ts";
|
|
21
|
+
import type { Token } from "../../models/token.ts";
|
|
22
|
+
import type { AbstractScope, BasicScope } from "../../models/scope.ts";
|
|
23
|
+
import type { UserServiceInterface } from "../services/user.ts";
|
|
24
|
+
import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.ts";
|
|
25
25
|
/** Services required by the password grant. */
|
|
26
26
|
export interface PasswordGrantServices<Client extends ClientInterface, User, S extends AbstractScope> extends GrantServices<Client, User, S> {
|
|
27
27
|
/** Authenticates the resource owner by username and password. */
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* RFC 6749 Section 6.
|
|
4
4
|
* @module
|
|
5
5
|
*/
|
|
6
|
-
import type { ClientInterface } from "../../models/client.
|
|
7
|
-
import type { RefreshToken } from "../../models/token.
|
|
8
|
-
import type { AbstractScope, BasicScope } from "../../models/scope.
|
|
9
|
-
import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.
|
|
6
|
+
import type { ClientInterface } from "../../models/client.ts";
|
|
7
|
+
import type { RefreshToken } from "../../models/token.ts";
|
|
8
|
+
import type { AbstractScope, BasicScope } from "../../models/scope.ts";
|
|
9
|
+
import { AbstractGrant, type GrantOptions, type GrantServices } from "./grant.ts";
|
|
10
10
|
/** Services required by the refresh token grant. */
|
|
11
11
|
export type RefreshTokenGrantServices<Client extends ClientInterface, User, S extends AbstractScope> = GrantServices<Client, User, S>;
|
|
12
12
|
/**
|
|
@@ -92,8 +92,7 @@ export class RefreshTokenGrant extends AbstractGrant {
|
|
|
92
92
|
nextScope = requestedScope;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
const familyExpiresAt = currentToken.familyCreatedAt &&
|
|
96
|
-
tokenService.refreshTokenFamilyExpiresAt
|
|
95
|
+
const familyExpiresAt = currentToken.familyCreatedAt && tokenService.refreshTokenFamilyExpiresAt
|
|
97
96
|
? await tokenService.refreshTokenFamilyExpiresAt(client, user, currentToken.familyCreatedAt, nextScope)
|
|
98
97
|
: undefined;
|
|
99
98
|
if (familyExpiresAt && familyExpiresAt.getTime() <= Date.now()) {
|
|
@@ -109,10 +108,10 @@ export class RefreshTokenGrant extends AbstractGrant {
|
|
|
109
108
|
};
|
|
110
109
|
// A rotation stays in its ancestor's family so replaying any rotated-out
|
|
111
110
|
// member revokes the whole chain.
|
|
112
|
-
nextRefreshToken.familyId =
|
|
113
|
-
nextRefreshToken.familyId;
|
|
114
|
-
nextRefreshToken.familyCreatedAt =
|
|
115
|
-
nextRefreshToken.familyCreatedAt;
|
|
111
|
+
nextRefreshToken.familyId =
|
|
112
|
+
currentToken.familyId ?? nextRefreshToken.familyId;
|
|
113
|
+
nextRefreshToken.familyCreatedAt =
|
|
114
|
+
currentToken.familyCreatedAt ?? nextRefreshToken.familyCreatedAt;
|
|
116
115
|
if (familyExpiresAt) {
|
|
117
116
|
this.capAtFamilyExpiry(nextRefreshToken, familyExpiresAt);
|
|
118
117
|
}
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
* @see https://datatracker.ietf.org/doc/html/rfc7662
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
|
-
import type { ClientInterface } from "../models/client.
|
|
13
|
-
import type { AbstractScope, ScopeConstructor } from "../models/scope.
|
|
14
|
-
import { BasicScope } from "../models/scope.
|
|
15
|
-
import type { IntrospectionResponse, Token } from "../models/token.
|
|
16
|
-
import type { TokenReaderInterface } from "./services/token.
|
|
12
|
+
import type { ClientInterface } from "../models/client.ts";
|
|
13
|
+
import type { AbstractScope, ScopeConstructor } from "../models/scope.ts";
|
|
14
|
+
import { BasicScope } from "../models/scope.ts";
|
|
15
|
+
import type { IntrospectionResponse, Token } from "../models/token.ts";
|
|
16
|
+
import type { TokenReaderInterface } from "./services/token.ts";
|
|
17
17
|
/**
|
|
18
18
|
* Options for configuring the introspection token reader.
|
|
19
19
|
*
|
|
@@ -71,8 +71,8 @@ export class IntrospectionTokenReader {
|
|
|
71
71
|
this.introspectionEndpoint = options.introspectionEndpoint;
|
|
72
72
|
this.clientId = options.clientId;
|
|
73
73
|
this.clientSecret = options.clientSecret;
|
|
74
|
-
this.Scope =
|
|
75
|
-
BasicScope;
|
|
74
|
+
this.Scope =
|
|
75
|
+
options.Scope ?? BasicScope;
|
|
76
76
|
this.getClient = options.getClient;
|
|
77
77
|
this.getUser = options.getUser;
|
|
78
78
|
this.fetchTimeoutMs = options.fetchTimeoutMs ?? 5_000;
|
|
@@ -138,7 +138,7 @@ export class IntrospectionTokenReader {
|
|
|
138
138
|
method: "POST",
|
|
139
139
|
headers: {
|
|
140
140
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
141
|
-
|
|
141
|
+
Authorization: encodeBasicAuth(this.clientId, this.clientSecret),
|
|
142
142
|
},
|
|
143
143
|
body: new URLSearchParams({ token: accessToken }),
|
|
144
144
|
signal: packageDeadlineSignal(controller.signal),
|
|
@@ -154,7 +154,7 @@ export class IntrospectionTokenReader {
|
|
|
154
154
|
: new ServerError(`token introspection failed (HTTP ${response.status})`);
|
|
155
155
|
}
|
|
156
156
|
try {
|
|
157
|
-
return await response.json();
|
|
157
|
+
return (await response.json());
|
|
158
158
|
}
|
|
159
159
|
catch (cause) {
|
|
160
160
|
throw controller.signal.aborted
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
* @see https://datatracker.ietf.org/doc/html/rfc7517
|
|
13
13
|
* @module
|
|
14
14
|
*/
|
|
15
|
-
import type { ClientInterface } from "../models/client.
|
|
16
|
-
import type { AbstractScope, ScopeConstructor } from "../models/scope.
|
|
17
|
-
import { BasicScope } from "../models/scope.
|
|
18
|
-
import type { Token } from "../models/token.
|
|
19
|
-
import type { TokenReaderInterface } from "./services/token.
|
|
15
|
+
import type { ClientInterface } from "../models/client.ts";
|
|
16
|
+
import type { AbstractScope, ScopeConstructor } from "../models/scope.ts";
|
|
17
|
+
import { BasicScope } from "../models/scope.ts";
|
|
18
|
+
import type { Token } from "../models/token.ts";
|
|
19
|
+
import type { TokenReaderInterface } from "./services/token.ts";
|
|
20
20
|
/**
|
|
21
21
|
* Claims of a validated JWT access token, as defined by RFC 9068 §2.2.
|
|
22
22
|
*
|
|
@@ -255,8 +255,8 @@ export class JwksTokenReader {
|
|
|
255
255
|
this.#cacheMaxAgeMs = options.cacheMaxAgeMs ?? 600_000;
|
|
256
256
|
this.#minFetchIntervalMs = options.minFetchIntervalMs ?? 30_000;
|
|
257
257
|
this.#fetchTimeoutMs = options.fetchTimeoutMs ?? 5_000;
|
|
258
|
-
this.#Scope =
|
|
259
|
-
BasicScope;
|
|
258
|
+
this.#Scope =
|
|
259
|
+
options.Scope ?? BasicScope;
|
|
260
260
|
this.#getClient = options.getClient;
|
|
261
261
|
this.#getUser = options.getUser;
|
|
262
262
|
this.#customFetch = options.fetch;
|
|
@@ -437,7 +437,7 @@ export class JwksTokenReader {
|
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
async #load() {
|
|
440
|
-
const jwksUri = this.#jwksUri ?? await this.#discoverJwksUri();
|
|
440
|
+
const jwksUri = this.#jwksUri ?? (await this.#discoverJwksUri());
|
|
441
441
|
const body = await this.#fetchJson(jwksUri, "jwks");
|
|
442
442
|
if (!isRecord(body) || !Array.isArray(body.keys)) {
|
|
443
443
|
throw new ServerError("jwks response has no `keys` array");
|
|
@@ -484,7 +484,7 @@ export class JwksTokenReader {
|
|
|
484
484
|
let response;
|
|
485
485
|
try {
|
|
486
486
|
response = await fetchImpl(url, {
|
|
487
|
-
headers: {
|
|
487
|
+
headers: { Accept: "application/json" },
|
|
488
488
|
signal: packageDeadlineSignal(controller.signal),
|
|
489
489
|
});
|
|
490
490
|
}
|
|
@@ -8,16 +8,15 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
export type {
|
|
13
|
-
export type {
|
|
14
|
-
export
|
|
15
|
-
export {
|
|
16
|
-
export
|
|
17
|
-
export {
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
20
|
-
export type {
|
|
21
|
-
export
|
|
22
|
-
export {
|
|
23
|
-
export type { IsPublicSuffix, RedirectUriPatternRule, RedirectUriPatternViolation, } from "./redirect-uri.js";
|
|
11
|
+
export type { ClientCredentials, ClientInterface } from "../models/client.ts";
|
|
12
|
+
export type { AuthenticationContext } from "../models/authentication.ts";
|
|
13
|
+
export type { IntrospectionResponse, RefreshToken, Token, TokenResponse, } from "../models/token.ts";
|
|
14
|
+
export { AbstractScope, BasicScope } from "../models/scope.ts";
|
|
15
|
+
export type { ScopeConstructor } from "../models/scope.ts";
|
|
16
|
+
export { Authorization, authorizationFromClaims, } from "../models/authorization.ts";
|
|
17
|
+
export type { AuthorizationFailure, AuthorizationInit, OrganizationContext, RequireConditions, } from "../models/authorization.ts";
|
|
18
|
+
export { AccessDeniedError, AuthorizationPendingError, ExpiredTokenError, InsufficientPermissionsError, InsufficientScopeError, InvalidClientError, InvalidGrantError, InvalidRequestError, InvalidScopeError, InvalidTokenError, isOAuth2Error, OAuth2Error, ServerError, SlowDownError, TemporarilyUnavailableError, toOAuth2Error, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, } from "../errors.ts";
|
|
19
|
+
export type { OAuth2ErrorClass, OAuth2ProblemDetailsExtensions, } from "../errors.ts";
|
|
20
|
+
export type { TokenReaderInterface } from "./services/token.ts";
|
|
21
|
+
export { checkRedirectUriPattern, isRedirectUriPattern, matchRedirectUri, } from "./redirect-uri.ts";
|
|
22
|
+
export type { IsPublicSuffix, RedirectUriPatternRule, RedirectUriPatternViolation, } from "./redirect-uri.ts";
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module
|
|
10
10
|
*/
|
|
11
|
-
import "../_dnt.polyfills.js";
|
|
12
11
|
export { AbstractScope, BasicScope } from "../models/scope.js";
|
|
13
12
|
export { Authorization, authorizationFromClaims, } from "../models/authorization.js";
|
|
14
13
|
export { AccessDeniedError, AuthorizationPendingError, ExpiredTokenError, InsufficientPermissionsError, InsufficientScopeError, InvalidClientError, InvalidGrantError, InvalidRequestError, InvalidScopeError, InvalidTokenError, isOAuth2Error, OAuth2Error, ServerError, SlowDownError, TemporarilyUnavailableError, toOAuth2Error, UnauthorizedClientError, UnsupportedGrantTypeError, UnsupportedResponseTypeError, UnsupportedTokenTypeError, } from "../errors.js";
|
|
@@ -26,13 +26,12 @@
|
|
|
26
26
|
* wildcard must not straddle (`github.io`, `vercel.app`, `blob.core.windows.net`)
|
|
27
27
|
* is listed there and nowhere else.
|
|
28
28
|
*
|
|
29
|
-
* Regenerate it with `
|
|
29
|
+
* Regenerate it with `pnpm psl:update`; `pnpm psl:check` fails when
|
|
30
30
|
* the snapshot has drifted from publicsuffix.org and runs on a schedule in CI.
|
|
31
31
|
*
|
|
32
32
|
* @module
|
|
33
33
|
*/
|
|
34
|
-
import "
|
|
35
|
-
import { publicSuffixListInfo } from "./rules.js";
|
|
34
|
+
import { publicSuffixListInfo } from "./rules.ts";
|
|
36
35
|
export { publicSuffixListInfo };
|
|
37
36
|
/**
|
|
38
37
|
* Whether a domain is a public suffix — a name others register *under* rather
|
|
@@ -26,12 +26,11 @@
|
|
|
26
26
|
* wildcard must not straddle (`github.io`, `vercel.app`, `blob.core.windows.net`)
|
|
27
27
|
* is listed there and nowhere else.
|
|
28
28
|
*
|
|
29
|
-
* Regenerate it with `
|
|
29
|
+
* Regenerate it with `pnpm psl:update`; `pnpm psl:check` fails when
|
|
30
30
|
* the snapshot has drifted from publicsuffix.org and runs on a schedule in CI.
|
|
31
31
|
*
|
|
32
32
|
* @module
|
|
33
33
|
*/
|
|
34
|
-
import "../../_dnt.polyfills.js";
|
|
35
34
|
import { PUBLIC_SUFFIX_RULES, publicSuffixListInfo } from "./rules.js";
|
|
36
35
|
export { publicSuffixListInfo };
|
|
37
36
|
let rules;
|
|
@@ -172,13 +172,13 @@ function matchesLoopback(registration, redirectUri) {
|
|
|
172
172
|
}
|
|
173
173
|
if (!LOOPBACK_HOSTNAMES.has(registeredUrl.hostname))
|
|
174
174
|
return false;
|
|
175
|
-
return registeredUrl.protocol === url.protocol &&
|
|
175
|
+
return (registeredUrl.protocol === url.protocol &&
|
|
176
176
|
registeredUrl.hostname === url.hostname &&
|
|
177
177
|
registeredUrl.username === url.username &&
|
|
178
178
|
registeredUrl.password === url.password &&
|
|
179
179
|
registeredUrl.pathname === url.pathname &&
|
|
180
180
|
registeredUrl.search === url.search &&
|
|
181
|
-
registeredUrl.hash === url.hash;
|
|
181
|
+
registeredUrl.hash === url.hash);
|
|
182
182
|
}
|
|
183
183
|
function matchesPattern(pattern, redirectUri, isPublicSuffix) {
|
|
184
184
|
if (checkRedirectUriPattern(pattern, isPublicSuffix) !== null)
|
|
@@ -220,8 +220,9 @@ function matchesPattern(pattern, redirectUri, isPublicSuffix) {
|
|
|
220
220
|
}
|
|
221
221
|
const [prefix, suffix] = patternLabels[0].split("*");
|
|
222
222
|
const label = labels[0];
|
|
223
|
-
return label.length >= prefix.length + suffix.length &&
|
|
224
|
-
label.startsWith(prefix) &&
|
|
223
|
+
return (label.length >= prefix.length + suffix.length &&
|
|
224
|
+
label.startsWith(prefix) &&
|
|
225
|
+
label.endsWith(suffix));
|
|
225
226
|
}
|
|
226
227
|
/**
|
|
227
228
|
* Find the registered redirect URI that authorizes a requested `redirect_uri`.
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
* @see https://datatracker.ietf.org/doc/html/rfc6750
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
import "../
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import { type
|
|
15
|
-
import
|
|
16
|
-
import type { TokenReaderInterface } from "./services/token.js";
|
|
9
|
+
import type { ClientInterface } from "../models/client.ts";
|
|
10
|
+
import type { Token } from "../models/token.ts";
|
|
11
|
+
import type { AbstractScope, ScopeConstructor } from "../models/scope.ts";
|
|
12
|
+
import { BasicScope } from "../models/scope.ts";
|
|
13
|
+
import { type OAuth2Error } from "../errors.ts";
|
|
14
|
+
import { type Authorization, type RequireConditions } from "../models/authorization.ts";
|
|
15
|
+
import type { TokenReaderInterface } from "./services/token.ts";
|
|
17
16
|
/** Bearer token regex pattern. */
|
|
18
17
|
export declare const BEARER_TOKEN: RegExp;
|
|
19
18
|
/** Services required by the resource server. */
|
|
@@ -300,7 +299,7 @@ export declare class ResourceServer<Client extends ClientInterface, User, S exte
|
|
|
300
299
|
*/
|
|
301
300
|
assertScope(granted: S | null | undefined, requiredScope: S | string): void;
|
|
302
301
|
}
|
|
303
|
-
export { IntrospectionTokenReader } from "./introspection-token-reader.
|
|
304
|
-
export type { IntrospectionTokenReaderOptions } from "./introspection-token-reader.
|
|
305
|
-
export { JwksTokenReader } from "./jwks-token-reader.
|
|
306
|
-
export type { JwksTokenReaderOptions, JwtAccessTokenClaims, } from "./jwks-token-reader.
|
|
302
|
+
export { IntrospectionTokenReader } from "./introspection-token-reader.ts";
|
|
303
|
+
export type { IntrospectionTokenReaderOptions } from "./introspection-token-reader.ts";
|
|
304
|
+
export { JwksTokenReader } from "./jwks-token-reader.ts";
|
|
305
|
+
export type { JwksTokenReaderOptions, JwtAccessTokenClaims, } from "./jwks-token-reader.ts";
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
* @see https://datatracker.ietf.org/doc/html/rfc6750
|
|
7
7
|
* @module
|
|
8
8
|
*/
|
|
9
|
-
import "../_dnt.polyfills.js";
|
|
10
9
|
import { BasicScope } from "../models/scope.js";
|
|
11
10
|
import { AccessDeniedError, InsufficientPermissionsError, InsufficientScopeError, InvalidTokenError, toOAuth2Error, } from "../errors.js";
|
|
12
11
|
import { authorizationFromClaims, } from "../models/authorization.js";
|
|
@@ -106,8 +105,8 @@ export class ResourceServer {
|
|
|
106
105
|
* overflows when converted to milliseconds.
|
|
107
106
|
*/
|
|
108
107
|
constructor(options) {
|
|
109
|
-
this.Scope =
|
|
110
|
-
BasicScope;
|
|
108
|
+
this.Scope =
|
|
109
|
+
options.Scope ?? BasicScope;
|
|
111
110
|
this.realm = options.realm ?? "Service";
|
|
112
111
|
this.clockSkewSeconds = options.clockSkewSeconds ?? 0;
|
|
113
112
|
this.errorFormat = options.errorFormat ?? "oauth2";
|
|
@@ -135,9 +134,11 @@ export class ResourceServer {
|
|
|
135
134
|
* @see https://datatracker.ietf.org/doc/html/rfc6750#section-3
|
|
136
135
|
*/
|
|
137
136
|
buildWwwAuthenticate(error, requiredScope) {
|
|
138
|
-
const quote = (value) =>
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
const quote = (value) => value
|
|
138
|
+
// oxlint-disable-next-line no-control-regex
|
|
139
|
+
.replace(/[\x00-\x1f\x7f]/g, "")
|
|
140
|
+
.replace(/\\/g, "\\\\")
|
|
141
|
+
.replace(/"/g, '\\"');
|
|
141
142
|
const parts = [`realm="${quote(this.realm)}"`];
|
|
142
143
|
const code = error?.extensions.error;
|
|
143
144
|
if (error && code && CHALLENGE_ERROR_CODES.has(code)) {
|
|
@@ -150,7 +151,8 @@ export class ResourceServer {
|
|
|
150
151
|
parts.push(`scope="${quote(requiredScope)}"`);
|
|
151
152
|
}
|
|
152
153
|
else if (error instanceof InsufficientScopeError) {
|
|
153
|
-
const scope = error.extensions
|
|
154
|
+
const scope = error.extensions
|
|
155
|
+
.requiredScope;
|
|
154
156
|
if (scope) {
|
|
155
157
|
parts.push(`scope="${quote(scope)}"`);
|
|
156
158
|
}
|
|
@@ -185,8 +187,7 @@ export class ResourceServer {
|
|
|
185
187
|
const body = {
|
|
186
188
|
error: oauth2Error.extensions.error ?? "server_error",
|
|
187
189
|
};
|
|
188
|
-
const description = oauth2Error.extensions.error_description ??
|
|
189
|
-
oauth2Error.exposedMessage;
|
|
190
|
+
const description = oauth2Error.extensions.error_description ?? oauth2Error.exposedMessage;
|
|
190
191
|
if (description) {
|
|
191
192
|
body.error_description = description;
|
|
192
193
|
}
|
|
@@ -296,8 +297,7 @@ export class ResourceServer {
|
|
|
296
297
|
throw new InvalidTokenError("invalid access token");
|
|
297
298
|
}
|
|
298
299
|
if (token.accessTokenExpiresAt) {
|
|
299
|
-
const deadline = token.accessTokenExpiresAt.getTime() +
|
|
300
|
-
this.clockSkewSeconds * 1000;
|
|
300
|
+
const deadline = token.accessTokenExpiresAt.getTime() + this.clockSkewSeconds * 1000;
|
|
301
301
|
if (deadline < Date.now()) {
|
|
302
302
|
throw new InvalidTokenError("access token has expired");
|
|
303
303
|
}
|
|
@@ -358,9 +358,7 @@ export class ResourceServer {
|
|
|
358
358
|
}
|
|
359
359
|
const failure = context.authorization.unmet(conditions);
|
|
360
360
|
if (failure) {
|
|
361
|
-
const required = failure.required === true
|
|
362
|
-
? "an active organization"
|
|
363
|
-
: failure.required;
|
|
361
|
+
const required = failure.required === true ? "an active organization" : failure.required;
|
|
364
362
|
throw new InsufficientPermissionsError(`${FAILURE_LABELS[failure.kind]}: ${required}`);
|
|
365
363
|
}
|
|
366
364
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Authorization code service interface and abstract implementation.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import type { AuthorizationCode } from "../../models/authorization-code.
|
|
6
|
-
import type { ClientInterface } from "../../models/client.
|
|
7
|
-
import type { AbstractScope, BasicScope } from "../../models/scope.
|
|
8
|
-
import type { ClientServiceInterface } from "./client.
|
|
9
|
-
import type { UserServiceInterface } from "./user.
|
|
5
|
+
import type { AuthorizationCode } from "../../models/authorization-code.ts";
|
|
6
|
+
import type { ClientInterface } from "../../models/client.ts";
|
|
7
|
+
import type { AbstractScope, BasicScope } from "../../models/scope.ts";
|
|
8
|
+
import type { ClientServiceInterface } from "./client.ts";
|
|
9
|
+
import type { UserServiceInterface } from "./user.ts";
|
|
10
10
|
/**
|
|
11
11
|
* Service interface for authorization code management.
|
|
12
12
|
*/
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @see https://datatracker.ietf.org/doc/html/rfc8628
|
|
5
5
|
* @module
|
|
6
6
|
*/
|
|
7
|
-
import type { ClientInterface } from "../../models/client.
|
|
8
|
-
import type { DeviceAuthorization } from "../../models/device-authorization.
|
|
9
|
-
import type { AbstractScope } from "../../models/scope.
|
|
7
|
+
import type { ClientInterface } from "../../models/client.ts";
|
|
8
|
+
import type { DeviceAuthorization } from "../../models/device-authorization.ts";
|
|
9
|
+
import type { AbstractScope } from "../../models/scope.ts";
|
|
10
10
|
/**
|
|
11
11
|
* Service interface for managing device authorizations.
|
|
12
12
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ClientInterface } from "../../models/client.
|
|
2
|
-
import type { AuthenticationContext } from "../../models/authentication.
|
|
3
|
-
import type { RefreshToken, Token } from "../../models/token.
|
|
4
|
-
import type { AbstractScope, BasicScope } from "../../models/scope.
|
|
5
|
-
import type { ClientServiceInterface } from "./client.
|
|
6
|
-
import type { UserServiceInterface } from "./user.
|
|
1
|
+
import type { ClientInterface } from "../../models/client.ts";
|
|
2
|
+
import type { AuthenticationContext } from "../../models/authentication.ts";
|
|
3
|
+
import type { RefreshToken, Token } from "../../models/token.ts";
|
|
4
|
+
import type { AbstractScope, BasicScope } from "../../models/scope.ts";
|
|
5
|
+
import type { ClientServiceInterface } from "./client.ts";
|
|
6
|
+
import type { UserServiceInterface } from "./user.ts";
|
|
7
7
|
/**
|
|
8
8
|
* Minimal interface for reading/validating tokens.
|
|
9
9
|
*
|
|
@@ -73,6 +73,8 @@ export class AbstractTokenService {
|
|
|
73
73
|
* configured. Override to cap per client instead of service-wide.
|
|
74
74
|
*/
|
|
75
75
|
refreshTokenFamilyExpiresAt(_client, _user, familyCreatedAt, _scope) {
|
|
76
|
-
return Promise.resolve(this.refreshTokenMaxLifetime == null
|
|
76
|
+
return Promise.resolve(this.refreshTokenMaxLifetime == null
|
|
77
|
+
? undefined
|
|
78
|
+
: new Date(familyCreatedAt.getTime() + this.refreshTokenMaxLifetime * 1000));
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -26,4 +26,4 @@ export interface UserServiceInterface<User> {
|
|
|
26
26
|
* `@udibo/oauth2/identity` for the work-factor constants and the
|
|
27
27
|
* `PasswordIdentityService` that records them on the credential.
|
|
28
28
|
*/
|
|
29
|
-
export { generateSalt, hashPassword, verifyPassword, } from "../../identity/password.
|
|
29
|
+
export { generateSalt, hashPassword, verifyPassword, } from "../../identity/password.ts";
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module
|
|
13
13
|
*/
|
|
14
|
-
import type { AuthenticationContext } from "../models/authentication.
|
|
14
|
+
import type { AuthenticationContext } from "../models/authentication.ts";
|
|
15
15
|
/** A ready-to-use signing key: private half signs, public JWK is published. */
|
|
16
16
|
export interface SigningKey {
|
|
17
17
|
/** Key id, stamped into JWS headers and the JWKS entry. */
|
|
@@ -148,7 +148,12 @@ export async function importSigningKeyJwk(jwk) {
|
|
|
148
148
|
* the primitive behind id_tokens and JWT access tokens.
|
|
149
149
|
*/
|
|
150
150
|
export async function signJwt(key, payload, header = {}) {
|
|
151
|
-
const signingInput = `${encodeSegment({
|
|
151
|
+
const signingInput = `${encodeSegment({
|
|
152
|
+
alg: key.alg,
|
|
153
|
+
typ: "JWT",
|
|
154
|
+
kid: key.kid,
|
|
155
|
+
...header,
|
|
156
|
+
})}.${encodeSegment(payload)}`;
|
|
152
157
|
const signature = await crypto.subtle.sign(ES256_SIGN_PARAMS, key.privateKey, encoder.encode(signingInput));
|
|
153
158
|
return `${signingInput}.${base64urlEncode(new Uint8Array(signature))}`;
|
|
154
159
|
}
|
|
@@ -173,7 +178,8 @@ export async function verifyJwt(jwt, publicJwk, options = {}) {
|
|
|
173
178
|
return undefined;
|
|
174
179
|
const payload = JSON.parse(decoder.decode(base64urlDecode(payloadPart)));
|
|
175
180
|
if (!options.ignoreExpiration &&
|
|
176
|
-
typeof payload.exp === "number" &&
|
|
181
|
+
typeof payload.exp === "number" &&
|
|
182
|
+
payload.exp * 1000 <= Date.now()) {
|
|
177
183
|
return undefined;
|
|
178
184
|
}
|
|
179
185
|
return payload;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Hashing utilities for secure token and secret storage.
|
|
3
3
|
* @module
|
|
4
4
|
*/
|
|
5
|
-
import { encodeHex } from "../../
|
|
5
|
+
import { encodeHex } from "../../utils/_encoding.js";
|
|
6
6
|
/** Hashes a high-entropy string (UUID, token, secret) using SHA-256. */
|
|
7
7
|
export async function sha256Hash(value) {
|
|
8
8
|
const data = new TextEncoder().encode(value);
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
*
|
|
39
39
|
* @module
|
|
40
40
|
*/
|
|
41
|
-
import type { AuthRequestStorage } from "../../client/storage.
|
|
41
|
+
import type { AuthRequestStorage } from "../../client/storage.ts";
|
|
42
42
|
/** Options for {@link runAuthRequestStorageContractTests}. */
|
|
43
43
|
export interface AuthRequestStorageContractOptions {
|
|
44
44
|
/**
|