@estifanos-sh/convex-auth 0.0.1-preview.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 +52 -0
- package/dist/_generated/component.d.ts +2981 -0
- package/dist/bin.js +7194 -0
- package/dist/browser/index.d.ts +22 -0
- package/dist/browser/index.js +61 -0
- package/dist/browser/locks.js +20 -0
- package/dist/browser/navigation.js +14 -0
- package/dist/browser/runtime.js +90 -0
- package/dist/browser/webauthn.js +99 -0
- package/dist/client/core/types.d.ts +615 -0
- package/dist/client/core/types.js +23 -0
- package/dist/client/errors.js +30 -0
- package/dist/client/factors/device.js +100 -0
- package/dist/client/factors/totp.js +111 -0
- package/dist/client/factors/webauthn.js +69 -0
- package/dist/client/index.d.ts +60 -0
- package/dist/client/index.js +976 -0
- package/dist/client/runtime/invite.js +50 -0
- package/dist/client/runtime/mutex.js +25 -0
- package/dist/client/runtime/proxy.js +75 -0
- package/dist/client/runtime/storage.js +65 -0
- package/dist/component/_generated/api.js +26 -0
- package/dist/component/_generated/component.d.ts +2981 -0
- package/dist/component/_generated/component.js +1 -0
- package/dist/component/_generated/dataModel.js +1 -0
- package/dist/component/_generated/server.js +74 -0
- package/dist/component/account.js +197 -0
- package/dist/component/connection/audit.js +152 -0
- package/dist/component/connection/cache.js +205 -0
- package/dist/component/connection/domain/verification.js +63 -0
- package/dist/component/connection/domain.js +108 -0
- package/dist/component/connection/saml/assertion.js +41 -0
- package/dist/component/connection/saml/request.js +61 -0
- package/dist/component/connection/scim/config.js +55 -0
- package/dist/component/connection/scim/identity.js +162 -0
- package/dist/component/connection/secret.js +65 -0
- package/dist/component/connection/webhook/delivery.js +396 -0
- package/dist/component/connection/webhook/endpoint.js +77 -0
- package/dist/component/connection.js +204 -0
- package/dist/component/convex.config.d.ts +7 -0
- package/dist/component/convex.config.js +15 -0
- package/dist/component/crons.js +27 -0
- package/dist/component/event.js +341 -0
- package/dist/component/factor/device.js +141 -0
- package/dist/component/factor/passkey.js +385 -0
- package/dist/component/factor/totp.js +253 -0
- package/dist/component/functions.js +3 -0
- package/dist/component/group/active.js +63 -0
- package/dist/component/group/invite.js +300 -0
- package/dist/component/group/member.js +188 -0
- package/dist/component/group.js +431 -0
- package/dist/component/http.js +9 -0
- package/dist/component/index.d.ts +5 -0
- package/dist/component/index.js +3 -0
- package/dist/component/limits.js +103 -0
- package/dist/component/maintenance.js +205 -0
- package/dist/component/migrations.js +277 -0
- package/dist/component/model.d.ts +384 -0
- package/dist/component/model.js +709 -0
- package/dist/component/modules.js +53 -0
- package/dist/component/oauth/client.js +196 -0
- package/dist/component/oauth/code.js +97 -0
- package/dist/component/oauth/refresh.js +230 -0
- package/dist/component/schema.d.ts +1530 -0
- package/dist/component/schema.js +401 -0
- package/dist/component/session.js +134 -0
- package/dist/component/token/pkce.js +121 -0
- package/dist/component/token/refresh.js +189 -0
- package/dist/component/token/verification.js +155 -0
- package/dist/component/user/email.js +147 -0
- package/dist/component/user/key.js +273 -0
- package/dist/component/user.js +173 -0
- package/dist/core/index.d.ts +531 -0
- package/dist/core/index.js +81 -0
- package/dist/expo/index.d.ts +43 -0
- package/dist/expo/index.js +131 -0
- package/dist/expo/webauthn.js +88 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/NoopLogger.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/api/logs.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/index.d.ts +7 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/AnyValue.d.ts +21 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LogRecord.d.ts +36 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/Logger.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LoggerOptions.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/src/types/LoggerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/baggage/propagation/W3CBaggagePropagator.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/baggage/utils.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/attributes.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/global-error-handler.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/logging-error-handler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/time.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/common/types.d.ts +16 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/index.d.ts +13 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/propagation/composite.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/TraceState.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/W3CTraceContextPropagator.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/rpc-metadata.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/trace/suppress-tracing.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_core@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/core/build/src/utils/configuration.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/LogRecordProcessor.d.ts +24 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/LoggerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/config/LoggerConfigurators.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/BatchLogRecordProcessorBase.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/ConsoleLogRecordExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/InMemoryLogRecordExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/LogRecordExporter.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/ReadableLogRecord.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/SdkLogRecord.d.ts +71 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/export/SimpleLogRecordProcessor.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/index.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/node/export/BatchLogRecordProcessor.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/platform/node/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-logs@0.214.0_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-logs/build/src/types.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/InstrumentDescriptor.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/MeterProvider.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Drop.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/ExponentialHistogram.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Histogram.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/LastValue.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/Sum.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/index.d.ts +6 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/aggregator/types.d.ts +53 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationSelector.d.ts +16 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/AggregationTemporality.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/CardinalitySelector.d.ts +10 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/ConsoleMetricExporter.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/InMemoryMetricExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricData.d.ts +148 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricProducer.d.ts +27 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/MetricReader.d.ts +138 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/export/PeriodicExportingMetricReader.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/index.d.ts +15 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/types.d.ts +10 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/utils.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/Aggregation.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/AggregationOption.d.ts +41 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/AttributesProcessor.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/InstrumentSelector.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-metrics@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-metrics/build/src/view/View.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/BasicTracerProvider.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/IdGenerator.d.ts +11 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/Sampler.d.ts +74 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/Span.d.ts +17 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/SpanProcessor.d.ts +43 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/TimedEvent.d.ts +19 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/BatchSpanProcessorBase.d.ts +6 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/ConsoleSpanExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/InMemorySpanExporter.d.ts +3 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/NoopSpanProcessor.d.ts +4 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/ReadableSpan.d.ts +29 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/SimpleSpanProcessor.d.ts +5 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/export/SpanExporter.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/index.d.ts +18 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/node/export/BatchSpanProcessor.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/platform/node/index.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/AlwaysOffSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/AlwaysOnSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/ParentBasedSampler.d.ts +2 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/sampler/TraceIdRatioBasedSampler.d.ts +1 -0
- package/dist/node_modules/.pnpm/@opentelemetry_sdk-trace-base@2.6.1_@opentelemetry_api@1.9.1/node_modules/@opentelemetry/sdk-trace-base/build/src/types.d.ts +66 -0
- package/dist/otel.d.ts +73 -0
- package/dist/otel.js +82 -0
- package/dist/permissions/index.d.ts +81 -0
- package/dist/permissions/index.js +18 -0
- package/dist/providers/anonymous.d.ts +35 -0
- package/dist/providers/anonymous.js +40 -0
- package/dist/providers/apple.d.ts +61 -0
- package/dist/providers/apple.js +57 -0
- package/dist/providers/connection.d.ts +30 -0
- package/dist/providers/connection.js +33 -0
- package/dist/providers/credentials.d.ts +78 -0
- package/dist/providers/credentials.js +31 -0
- package/dist/providers/custom.d.ts +96 -0
- package/dist/providers/custom.js +108 -0
- package/dist/providers/device.d.ts +33 -0
- package/dist/providers/device.js +30 -0
- package/dist/providers/email.d.ts +45 -0
- package/dist/providers/email.js +52 -0
- package/dist/providers/github.d.ts +56 -0
- package/dist/providers/github.js +79 -0
- package/dist/providers/google.d.ts +56 -0
- package/dist/providers/google.js +59 -0
- package/dist/providers/index.d.ts +16 -0
- package/dist/providers/index.js +16 -0
- package/dist/providers/microsoft.d.ts +59 -0
- package/dist/providers/microsoft.js +98 -0
- package/dist/providers/password.d.ts +68 -0
- package/dist/providers/password.js +348 -0
- package/dist/providers/phone.d.ts +33 -0
- package/dist/providers/phone.js +35 -0
- package/dist/providers/redirect.d.ts +1 -0
- package/dist/providers/redirect.js +11 -0
- package/dist/providers/totp.d.ts +29 -0
- package/dist/providers/totp.js +29 -0
- package/dist/providers/webauthn/attestation.d.ts +42 -0
- package/dist/providers/webauthn/attestation.js +167 -0
- package/dist/providers/webauthn.d.ts +83 -0
- package/dist/providers/webauthn.js +57 -0
- package/dist/react/index.d.ts +55 -0
- package/dist/react/index.js +80 -0
- package/dist/server/auth.d.ts +443 -0
- package/dist/server/auth.js +178 -0
- package/dist/server/cache/context.js +94 -0
- package/dist/server/component/api.d.ts +14 -0
- package/dist/server/component/api.js +13 -0
- package/dist/server/component/context.d.ts +16 -0
- package/dist/server/component/context.js +1 -0
- package/dist/server/component/factor/db.js +71 -0
- package/dist/server/config.d.ts +3 -0
- package/dist/server/config.js +78 -0
- package/dist/server/connection/config.js +101 -0
- package/dist/server/connection/domain.d.ts +878 -0
- package/dist/server/connection/domain.js +1122 -0
- package/dist/server/connection/group/service.d.ts +25 -0
- package/dist/server/connection/group/service.js +250 -0
- package/dist/server/connection/http.js +1485 -0
- package/dist/server/connection/oidc.js +366 -0
- package/dist/server/connection/policy/domain.js +59 -0
- package/dist/server/connection/policy.d.ts +1 -0
- package/dist/server/connection/policy.js +163 -0
- package/dist/server/connection/profile.js +22 -0
- package/dist/server/connection/provision.js +182 -0
- package/dist/server/connection/saml/api.js +70 -0
- package/dist/server/connection/saml/binding/post.js +140 -0
- package/dist/server/connection/saml/binding/redirect.js +139 -0
- package/dist/server/connection/saml/binding/shared.js +18 -0
- package/dist/server/connection/saml/c14n.js +224 -0
- package/dist/server/connection/saml/constants.js +100 -0
- package/dist/server/connection/saml/crypto.js +170 -0
- package/dist/server/connection/saml/dom/select.js +299 -0
- package/dist/server/connection/saml/encoding.js +93 -0
- package/dist/server/connection/saml/encryption.js +34 -0
- package/dist/server/connection/saml/entity.js +24 -0
- package/dist/server/connection/saml/extractor.js +408 -0
- package/dist/server/connection/saml/flow.js +150 -0
- package/dist/server/connection/saml/identity/provider.js +66 -0
- package/dist/server/connection/saml/index.js +5 -0
- package/dist/server/connection/saml/metadata.js +294 -0
- package/dist/server/connection/saml/service/provider.js +117 -0
- package/dist/server/connection/saml/signature.js +214 -0
- package/dist/server/connection/saml/template.js +68 -0
- package/dist/server/connection/saml/types.js +1 -0
- package/dist/server/connection/saml/validator.js +32 -0
- package/dist/server/connection/saml/xml/builder.js +68 -0
- package/dist/server/connection/saml/xmldsig.js +598 -0
- package/dist/server/connection/saml/xmlenc.js +162 -0
- package/dist/server/connection/saml.d.ts +56 -0
- package/dist/server/connection/saml.js +762 -0
- package/dist/server/connection/scim.js +115 -0
- package/dist/server/connection/shared.js +74 -0
- package/dist/server/connection/webhook.js +163 -0
- package/dist/server/context.d.ts +137 -0
- package/dist/server/context.js +108 -0
- package/dist/server/contract.d.ts +48 -0
- package/dist/server/contract.js +107 -0
- package/dist/server/cookies.js +90 -0
- package/dist/server/core.js +163 -0
- package/dist/server/cors.d.ts +22 -0
- package/dist/server/cors.js +93 -0
- package/dist/server/crypto.js +43 -0
- package/dist/server/db.js +88 -0
- package/dist/server/device.js +140 -0
- package/dist/server/domains/access.js +29 -0
- package/dist/server/domains/account.d.ts +16 -0
- package/dist/server/domains/account.js +92 -0
- package/dist/server/domains/factor.d.ts +28 -0
- package/dist/server/domains/factor.js +115 -0
- package/dist/server/domains/group.js +87 -0
- package/dist/server/domains/invite.js +76 -0
- package/dist/server/domains/key.js +253 -0
- package/dist/server/domains/member.js +149 -0
- package/dist/server/domains/session.js +29 -0
- package/dist/server/domains/user.js +119 -0
- package/dist/server/env.d.ts +46 -0
- package/dist/server/env.js +96 -0
- package/dist/server/errors.js +38 -0
- package/dist/server/events.d.ts +880 -0
- package/dist/server/events.js +406 -0
- package/dist/server/facade.d.ts +83 -0
- package/dist/server/facade.js +124 -0
- package/dist/server/http.d.ts +125 -0
- package/dist/server/http.js +566 -0
- package/dist/server/identity/claims.js +58 -0
- package/dist/server/identity/convex.d.ts +15 -0
- package/dist/server/identity/convex.js +1 -0
- package/dist/server/index.d.ts +17 -0
- package/dist/server/index.js +11 -0
- package/dist/server/keys.js +60 -0
- package/dist/server/limits.js +41 -0
- package/dist/server/log.js +28 -0
- package/dist/server/mcp.d.ts +19 -0
- package/dist/server/mcp.js +250 -0
- package/dist/server/mutations/account.js +47 -0
- package/dist/server/mutations/calls.js +16 -0
- package/dist/server/mutations/code.js +91 -0
- package/dist/server/mutations/credentials/signin.js +210 -0
- package/dist/server/mutations/invalidate.js +60 -0
- package/dist/server/mutations/oauth.js +251 -0
- package/dist/server/mutations/refresh.js +152 -0
- package/dist/server/mutations/register.js +93 -0
- package/dist/server/mutations/retrieve.js +66 -0
- package/dist/server/mutations/signature.js +36 -0
- package/dist/server/mutations/signin.js +81 -0
- package/dist/server/mutations/signout.js +61 -0
- package/dist/server/mutations/store/refs.js +15 -0
- package/dist/server/mutations/store.js +82 -0
- package/dist/server/mutations/verifier.js +25 -0
- package/dist/server/mutations/verify.js +199 -0
- package/dist/server/oauth/authorize.js +98 -0
- package/dist/server/oauth/client.d.ts +93 -0
- package/dist/server/oauth/client.js +115 -0
- package/dist/server/oauth/code.d.ts +63 -0
- package/dist/server/oauth/code.js +124 -0
- package/dist/server/oauth/domain.d.ts +23 -0
- package/dist/server/oauth/domain.js +1 -0
- package/dist/server/oauth/factory.js +46 -0
- package/dist/server/oauth/grant.js +46 -0
- package/dist/server/oauth/handlers.js +108 -0
- package/dist/server/oauth/manage.js +121 -0
- package/dist/server/oauth/normalize.js +27 -0
- package/dist/server/oauth/refresh.d.ts +71 -0
- package/dist/server/oauth/refresh.js +132 -0
- package/dist/server/oauth/register.js +147 -0
- package/dist/server/oauth/runtime.js +280 -0
- package/dist/server/oauth/token.js +355 -0
- package/dist/server/payloads.d.ts +16 -0
- package/dist/server/payloads.js +30 -0
- package/dist/server/preload.d.ts +249 -0
- package/dist/server/preload.js +673 -0
- package/dist/server/random.js +25 -0
- package/dist/server/redirects.js +85 -0
- package/dist/server/runtime.d.ts +845 -0
- package/dist/server/runtime.js +387 -0
- package/dist/server/secret.js +46 -0
- package/dist/server/services/factors.js +117 -0
- package/dist/server/services/providers.js +23 -0
- package/dist/server/services/resolve.js +17 -0
- package/dist/server/session/lifecycle.d.ts +23 -0
- package/dist/server/session/lifecycle.js +139 -0
- package/dist/server/signin/flow.js +359 -0
- package/dist/server/telemetry.js +68 -0
- package/dist/server/templates.js +91 -0
- package/dist/server/token/refresh.js +35 -0
- package/dist/server/tokens.js +164 -0
- package/dist/server/totp.js +282 -0
- package/dist/server/types.d.ts +1154 -0
- package/dist/server/types.js +1 -0
- package/dist/server/url.js +43 -0
- package/dist/server/user/account.js +325 -0
- package/dist/server/utils/bearer.js +24 -0
- package/dist/server/utils/cache.js +51 -0
- package/dist/server/utils/retry.js +3 -0
- package/dist/server/utils/span.js +59 -0
- package/dist/server/validators.d.ts +2061 -0
- package/dist/server/validators.js +320 -0
- package/dist/server/webauthn.js +699 -0
- package/dist/server/wellknown.d.ts +74 -0
- package/dist/server/wellknown.js +195 -0
- package/dist/shared/brand.d.ts +28 -0
- package/dist/shared/brand.js +13 -0
- package/dist/shared/codes.d.ts +99 -0
- package/dist/shared/codes.js +98 -0
- package/dist/shared/compare.js +23 -0
- package/dist/shared/errors.js +24 -0
- package/dist/shared/event/kinds.d.ts +188 -0
- package/dist/shared/event/kinds.js +103 -0
- package/dist/shared/fetch/guard.js +189 -0
- package/dist/shared/log.js +62 -0
- package/dist/shared/results.d.ts +58 -0
- package/dist/shared/retry.js +27 -0
- package/dist/shared/webauthn.js +9 -0
- package/dist/svelte/AuthLoading.svelte +13 -0
- package/dist/svelte/AuthLoading.svelte.d.ts +8 -0
- package/dist/svelte/SignedIn.svelte +14 -0
- package/dist/svelte/SignedIn.svelte.d.ts +8 -0
- package/dist/svelte/SignedOut.svelte +13 -0
- package/dist/svelte/SignedOut.svelte.d.ts +8 -0
- package/dist/svelte/context.svelte.d.ts +26 -0
- package/dist/svelte/context.svelte.js +61 -0
- package/dist/svelte/index.d.ts +5 -0
- package/dist/svelte/index.js +4 -0
- package/dist/test.d.ts +48 -0
- package/dist/test.js +54 -0
- package/package.json +247 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { ComponentReadCtx } from "./component/context.js";
|
|
2
|
+
import { HttpKeyContext } from "./types.js";
|
|
3
|
+
import { AuthContext, OptionalAuthContext, UserDoc } from "./context.js";
|
|
4
|
+
import "./auth.js";
|
|
5
|
+
import { GenericActionCtx, GenericDataModel, HttpRouter, UserIdentity } from "convex/server";
|
|
6
|
+
|
|
7
|
+
//#region src/server/http.d.ts
|
|
8
|
+
type HttpIdentityCtx = {
|
|
9
|
+
auth: {
|
|
10
|
+
getUserIdentity: () => Promise<UserIdentity | null>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
type HttpContextCtx = HttpIdentityCtx & ComponentReadCtx;
|
|
14
|
+
/**
|
|
15
|
+
* Auth context returned by `auth.request.context(ctx, request)`.
|
|
16
|
+
*
|
|
17
|
+
* This resolves raw HTTP authentication in two steps:
|
|
18
|
+
* 1. session auth from `ctx.auth.getUserIdentity()`
|
|
19
|
+
* 2. API key auth from `Authorization: Bearer sk_*`
|
|
20
|
+
*
|
|
21
|
+
* The `source` field tells you which authentication path succeeded.
|
|
22
|
+
* When `source === "key"`, the verified API key metadata is available on
|
|
23
|
+
* `key`.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const authContext = await auth.request.context(ctx, request);
|
|
28
|
+
* if (authContext.source === "key") {
|
|
29
|
+
* console.log(authContext.key.keyId);
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
type HttpAuthContext = (AuthContext & {
|
|
34
|
+
/** The request authenticated through a browser or session token. */source: "session"; /** No API key was used for this request. */
|
|
35
|
+
key: null;
|
|
36
|
+
oauth: null;
|
|
37
|
+
}) | (AuthContext & {
|
|
38
|
+
/** The request authenticated through an API key. */source: "key"; /** Verified API key metadata for the request. */
|
|
39
|
+
key: HttpKeyContext["key"];
|
|
40
|
+
oauth: null;
|
|
41
|
+
}) | (AuthContext & {
|
|
42
|
+
source: "oauth";
|
|
43
|
+
key: null;
|
|
44
|
+
oauth: {
|
|
45
|
+
clientId: string;
|
|
46
|
+
scopes: string[];
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Nullable HTTP auth context returned by
|
|
51
|
+
* `auth.request.context.optional(ctx, request)`.
|
|
52
|
+
*
|
|
53
|
+
* This preserves a stable auth-shaped object for raw `httpAction` handlers
|
|
54
|
+
* that allow anonymous callers.
|
|
55
|
+
*/
|
|
56
|
+
type OptionalHttpAuthContext = (OptionalAuthContext & {
|
|
57
|
+
/** No authentication source was resolved. */source: null; /** No API key metadata is available. */
|
|
58
|
+
key: null;
|
|
59
|
+
oauth: null;
|
|
60
|
+
}) | HttpAuthContext;
|
|
61
|
+
/**
|
|
62
|
+
* Configuration for {@link defineAuth().request.context}.
|
|
63
|
+
*
|
|
64
|
+
* This mirrors {@link AuthContextConfig} for raw HTTP handlers and adds support
|
|
65
|
+
* for enriching mixed session/API-key auth results.
|
|
66
|
+
*
|
|
67
|
+
* @typeParam TResolve - Extra fields returned from `resolve()` and merged into
|
|
68
|
+
* the resolved HTTP auth context.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const authContext = await auth.request.context(ctx, request, {
|
|
73
|
+
* resolve: async (_ctx, user, authState) => ({
|
|
74
|
+
* email: user.email,
|
|
75
|
+
* isMachineRequest: authState.source === "key",
|
|
76
|
+
* }),
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
type HttpAuthContextConfig<TResolve extends Record<string, unknown> = Record<string, never>, TCtx extends HttpContextCtx = HttpContextCtx> = {
|
|
81
|
+
/**
|
|
82
|
+
* Attach additional derived fields to the resolved HTTP auth context.
|
|
83
|
+
*
|
|
84
|
+
* This callback runs only when authentication succeeds.
|
|
85
|
+
*/
|
|
86
|
+
resolve?: (ctx: TCtx, user: UserDoc, auth: HttpAuthContext) => Promise<TResolve> | TResolve;
|
|
87
|
+
/**
|
|
88
|
+
* Override or wrap HTTP auth resolution.
|
|
89
|
+
*
|
|
90
|
+
* Return `undefined` to use the built-in session-or-key resolver, `null` for
|
|
91
|
+
* an explicit unauthenticated state, or a fully resolved
|
|
92
|
+
* {@link HttpAuthContext}.
|
|
93
|
+
*/
|
|
94
|
+
authResolve?: (ctx: TCtx, fallback: () => Promise<HttpAuthContext | null>) => Promise<HttpAuthContext | null | undefined> | HttpAuthContext | null | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* RFC 8707 resource assertion (opt-in). When set, an OAuth `at+jwt` bearer is
|
|
97
|
+
* only accepted on this route if its `resource` claim equals this value — so a
|
|
98
|
+
* token minted for a different protected resource is not honored here. Omit it
|
|
99
|
+
* (the default) to accept any valid OAuth identity; capability is still bounded
|
|
100
|
+
* by scope grant-intersection regardless. The `/mcp` route sets this to its
|
|
101
|
+
* canonical resource.
|
|
102
|
+
*/
|
|
103
|
+
resource?: string;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Resolver for `auth.request.context(ctx, request, config?)`.
|
|
107
|
+
*
|
|
108
|
+
* Authentication sources are tried in a fixed order: OAuth access tokens
|
|
109
|
+
* first (an `at+jwt` bearer is also a valid Convex identity, so it must be
|
|
110
|
+
* classified as `oauth` before the session branch would claim it), then the
|
|
111
|
+
* session identity, then `Bearer sk_*` API keys. Session therefore takes
|
|
112
|
+
* precedence over an API key when both are present.
|
|
113
|
+
*/
|
|
114
|
+
interface HttpContextResolver {
|
|
115
|
+
<TResolve extends Record<string, unknown> = Record<string, never>, TCtx extends HttpContextCtx = HttpContextCtx>(ctx: TCtx, request: Request, config?: HttpAuthContextConfig<TResolve, TCtx>): Promise<HttpAuthContext & TResolve>;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Nullable variant for `auth.request.context.optional(ctx, request, config?)`.
|
|
119
|
+
*/
|
|
120
|
+
interface OptionalHttpContextResolver {
|
|
121
|
+
<TResolve extends Record<string, unknown> = Record<string, never>, TCtx extends HttpContextCtx = HttpContextCtx>(ctx: TCtx, request: Request, config?: HttpAuthContextConfig<TResolve, TCtx>): Promise<OptionalHttpAuthContext & TResolve>;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { HttpAuthContext, HttpAuthContextConfig, HttpContextResolver, OptionalHttpAuthContext, OptionalHttpContextResolver };
|
|
125
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
import { ErrorCode } from "../shared/codes.js";
|
|
2
|
+
import { createUnauthenticatedAuthContext, getAuthContextForUser, getSessionUserId } from "./context.js";
|
|
3
|
+
import { logError } from "./log.js";
|
|
4
|
+
import { verifyOAuthToken } from "./tokens.js";
|
|
5
|
+
import { buildCorsHeaders, corsPreflightHandler, corsPreflightResponse, registerCorsPreflight, withCors } from "./cors.js";
|
|
6
|
+
import { extractBearerToken } from "./utils/bearer.js";
|
|
7
|
+
import { ConvexError } from "convex/values";
|
|
8
|
+
import { httpActionGeneric } from "convex/server";
|
|
9
|
+
import { parse } from "cookie";
|
|
10
|
+
|
|
11
|
+
//#region src/server/http.ts
|
|
12
|
+
function createNotSignedInError() {
|
|
13
|
+
return new ConvexError({
|
|
14
|
+
code: ErrorCode.NOT_SIGNED_IN,
|
|
15
|
+
message: "Authentication required."
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Extract a `{ code, message }` body from a thrown value for the non-OAuth JSON
|
|
20
|
+
* HTTP surface. A structured `ConvexError` carrying `code`/`message` is surfaced
|
|
21
|
+
* verbatim; anything else collapses to an opaque `INTERNAL_ERROR`.
|
|
22
|
+
*/
|
|
23
|
+
function convexErrorToBody(error) {
|
|
24
|
+
if (error instanceof ConvexError && typeof error.data === "object" && error.data !== null && "code" in error.data && "message" in error.data) {
|
|
25
|
+
const { code, message } = error.data;
|
|
26
|
+
return {
|
|
27
|
+
code,
|
|
28
|
+
message
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
code: ErrorCode.INTERNAL_ERROR,
|
|
33
|
+
message: "An unexpected error occurred."
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build a JSON error `Response` for the non-OAuth HTTP surface, in the single
|
|
38
|
+
* `{ code, message }` shape. OAuth wire endpoints use the RFC 6749
|
|
39
|
+
* `{ error, error_description }` shape instead (see `oauth/*`).
|
|
40
|
+
*/
|
|
41
|
+
function jsonError(status, body, extraHeaders) {
|
|
42
|
+
return new Response(JSON.stringify(body), {
|
|
43
|
+
status,
|
|
44
|
+
headers: {
|
|
45
|
+
"Content-Type": "application/json",
|
|
46
|
+
...extraHeaders
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async function getHttpKeyContext(auth, ctx, request) {
|
|
51
|
+
const token = extractBearerToken(request);
|
|
52
|
+
if (token === null || !token.startsWith("sk_")) return null;
|
|
53
|
+
try {
|
|
54
|
+
/**
|
|
55
|
+
* The `Bearer sk_*` branch only runs inside an HTTP action, where the
|
|
56
|
+
* resolved `ctx` additionally carries the `runMutation` that `key.verify`
|
|
57
|
+
* needs. The HTTP-context surface is otherwise query-shaped, so this one
|
|
58
|
+
* narrow assertion supplies that single missing member at the boundary.
|
|
59
|
+
*/
|
|
60
|
+
const keyVerifyCtx = ctx;
|
|
61
|
+
const verified = await auth.key.verify(keyVerifyCtx, { secret: token });
|
|
62
|
+
return {
|
|
63
|
+
...await getAuthContextForUser(auth, ctx, verified.userId),
|
|
64
|
+
source: "key",
|
|
65
|
+
key: {
|
|
66
|
+
userId: verified.userId,
|
|
67
|
+
keyId: verified.keyId,
|
|
68
|
+
scopes: verified.scopes
|
|
69
|
+
},
|
|
70
|
+
oauth: null
|
|
71
|
+
};
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.error("[auth] HTTP key verification failed", { err });
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function getHttpOAuthContext(auth, ctx, request, resource, issuer) {
|
|
78
|
+
const token = extractBearerToken(request);
|
|
79
|
+
if (token === null || token.startsWith("sk_")) return null;
|
|
80
|
+
const oauthPayload = await verifyOAuthToken(token, {
|
|
81
|
+
...issuer !== void 0 ? { issuer } : {},
|
|
82
|
+
...resource !== void 0 ? { resource } : {}
|
|
83
|
+
});
|
|
84
|
+
if (!oauthPayload) return null;
|
|
85
|
+
try {
|
|
86
|
+
return {
|
|
87
|
+
...await getAuthContextForUser(auth, ctx, oauthPayload.userId, oauthPayload.scopes),
|
|
88
|
+
source: "oauth",
|
|
89
|
+
key: null,
|
|
90
|
+
oauth: {
|
|
91
|
+
clientId: oauthPayload.clientId,
|
|
92
|
+
scopes: oauthPayload.scopes
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
} catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async function resolveHttpAuthContext(auth, ctx, request, resource, issuer) {
|
|
100
|
+
const oauthContext = await getHttpOAuthContext(auth, ctx, request, resource, issuer);
|
|
101
|
+
if (oauthContext !== null) return oauthContext;
|
|
102
|
+
const sessionUserId = await getSessionUserId(ctx);
|
|
103
|
+
if (sessionUserId !== null) return {
|
|
104
|
+
...await getAuthContextForUser(auth, ctx, sessionUserId),
|
|
105
|
+
source: "session",
|
|
106
|
+
key: null,
|
|
107
|
+
oauth: null
|
|
108
|
+
};
|
|
109
|
+
return await getHttpKeyContext(auth, ctx, request);
|
|
110
|
+
}
|
|
111
|
+
async function resolveHttpContext(auth, ctx, request, config, optional, options) {
|
|
112
|
+
const fallback = () => resolveHttpAuthContext(auth, ctx, request, config?.resource, options.issuer?.());
|
|
113
|
+
const authOverride = config?.authResolve ? await config.authResolve(ctx, fallback) : void 0;
|
|
114
|
+
const resolved = authOverride === void 0 ? await fallback() : authOverride;
|
|
115
|
+
if (resolved === null) {
|
|
116
|
+
if (!optional) throw createNotSignedInError();
|
|
117
|
+
return {
|
|
118
|
+
...createUnauthenticatedAuthContext(),
|
|
119
|
+
source: null,
|
|
120
|
+
key: null,
|
|
121
|
+
oauth: null
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
const extra = config?.resolve ? await config.resolve(ctx, resolved.user, resolved) : {};
|
|
125
|
+
return {
|
|
126
|
+
...resolved,
|
|
127
|
+
...extra
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @internal
|
|
132
|
+
* Create the implementation behind `auth.request.context(...)` and
|
|
133
|
+
* `auth.request.context.optional(...)`.
|
|
134
|
+
*
|
|
135
|
+
* The two assertions below bind a concrete (monomorphic) closure to the
|
|
136
|
+
* generic call-signature interfaces {@link HttpContextResolver} /
|
|
137
|
+
* {@link OptionalHttpContextResolver}; TypeScript cannot infer those generics
|
|
138
|
+
* from a non-generic body, so the typed assertion is the irreducible bridge.
|
|
139
|
+
*/
|
|
140
|
+
function createHttpContext(auth, options = {}) {
|
|
141
|
+
const required = ((ctx, request, config) => resolveHttpContext(auth, ctx, request, config, false, options));
|
|
142
|
+
required.optional = ((ctx, request, config) => resolveHttpContext(auth, ctx, request, config, true, options));
|
|
143
|
+
return required;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Build the Bearer-key HTTP action wrapper behind `auth.request.action(...)`.
|
|
147
|
+
*
|
|
148
|
+
* Returns a function that wraps a handler with `Authorization: Bearer sk_*`
|
|
149
|
+
* verification, optional scope checks, CORS headers, and JSON error envelopes.
|
|
150
|
+
*
|
|
151
|
+
* @param auth - Provides `key.verify` for API key verification.
|
|
152
|
+
* @param defaultOrigins - Allowed CORS origins (or a getter) used when a route
|
|
153
|
+
* supplies no `cors` config.
|
|
154
|
+
*/
|
|
155
|
+
function createHttpAction(auth, defaultOrigins) {
|
|
156
|
+
return (handler, options) => {
|
|
157
|
+
return httpActionGeneric(async (genericCtx, request) => {
|
|
158
|
+
const corsHeaders = buildCorsHeaders(request, options?.cors, defaultOrigins);
|
|
159
|
+
try {
|
|
160
|
+
const rawKey = extractBearerToken(request);
|
|
161
|
+
if (rawKey === null) return jsonError(401, {
|
|
162
|
+
code: ErrorCode.MISSING_BEARER_TOKEN,
|
|
163
|
+
message: "Missing or malformed Authorization: Bearer header."
|
|
164
|
+
}, corsHeaders);
|
|
165
|
+
let keyResult;
|
|
166
|
+
try {
|
|
167
|
+
keyResult = {
|
|
168
|
+
ok: true,
|
|
169
|
+
value: await auth.key.verify(genericCtx, { secret: rawKey })
|
|
170
|
+
};
|
|
171
|
+
} catch (error) {
|
|
172
|
+
keyResult = {
|
|
173
|
+
ok: false,
|
|
174
|
+
error
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (!keyResult.ok) {
|
|
178
|
+
if (keyResult.error instanceof ConvexError && typeof keyResult.error.data === "object" && keyResult.error.data !== null && "code" in keyResult.error.data && "message" in keyResult.error.data) return jsonError(403, convexErrorToBody(keyResult.error), corsHeaders);
|
|
179
|
+
throw keyResult.error;
|
|
180
|
+
}
|
|
181
|
+
if (options?.scope && !keyResult.value.scopes.can(options.scope.resource, options.scope.action)) return jsonError(403, {
|
|
182
|
+
code: ErrorCode.SCOPE_CHECK_FAILED,
|
|
183
|
+
message: "This API key does not have the required permissions."
|
|
184
|
+
}, corsHeaders);
|
|
185
|
+
const result = await handler(Object.assign(genericCtx, { key: {
|
|
186
|
+
userId: keyResult.value.userId,
|
|
187
|
+
keyId: keyResult.value.keyId,
|
|
188
|
+
scopes: keyResult.value.scopes
|
|
189
|
+
} }), request);
|
|
190
|
+
return result instanceof Response ? (() => {
|
|
191
|
+
const headers = new Headers(result.headers);
|
|
192
|
+
for (const [k, val] of Object.entries(corsHeaders)) if (!headers.has(k)) headers.set(k, val);
|
|
193
|
+
return new Response(result.body, {
|
|
194
|
+
status: result.status,
|
|
195
|
+
statusText: result.statusText,
|
|
196
|
+
headers
|
|
197
|
+
});
|
|
198
|
+
})() : new Response(JSON.stringify(result), {
|
|
199
|
+
status: 200,
|
|
200
|
+
headers: {
|
|
201
|
+
...corsHeaders,
|
|
202
|
+
"Content-Type": "application/json"
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
} catch (error) {
|
|
206
|
+
logError(error);
|
|
207
|
+
return jsonError(500, {
|
|
208
|
+
code: ErrorCode.INTERNAL_ERROR,
|
|
209
|
+
message: "An unexpected error occurred."
|
|
210
|
+
}, corsHeaders);
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Build the route registrar behind `auth.request.route(...)`.
|
|
217
|
+
*
|
|
218
|
+
* Returns a function that registers a Bearer-authenticated route plus its
|
|
219
|
+
* matching `OPTIONS` CORS preflight in one call.
|
|
220
|
+
*
|
|
221
|
+
* @param wrapAction - The wrapper produced by {@link createHttpAction}.
|
|
222
|
+
* @param defaultOrigins - Allowed CORS origins (or a getter) for the preflight.
|
|
223
|
+
*/
|
|
224
|
+
function createHttpRoute(wrapAction, defaultOrigins) {
|
|
225
|
+
return (http, routeConfig) => {
|
|
226
|
+
http.route({
|
|
227
|
+
path: routeConfig.path,
|
|
228
|
+
method: "OPTIONS",
|
|
229
|
+
handler: httpActionGeneric(async (_ctx, request) => corsPreflightResponse(request, routeConfig.cors, defaultOrigins))
|
|
230
|
+
});
|
|
231
|
+
http.route({
|
|
232
|
+
path: routeConfig.path,
|
|
233
|
+
method: routeConfig.method,
|
|
234
|
+
handler: wrapAction(routeConfig.handler, {
|
|
235
|
+
scope: routeConfig.scope,
|
|
236
|
+
cors: routeConfig.cors
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Wrap an HTTP action so thrown `ConvexError`s become JSON error responses.
|
|
243
|
+
*
|
|
244
|
+
* Structured `{ code, message }` errors return `errorStatusCode`; other
|
|
245
|
+
* `ConvexError`s return that status with a plain status text; any other error
|
|
246
|
+
* is logged and returns a 500.
|
|
247
|
+
*
|
|
248
|
+
* @param errorStatusCode - Status used for `ConvexError`s.
|
|
249
|
+
* @param action - The wrapped HTTP action.
|
|
250
|
+
*/
|
|
251
|
+
function convertErrorsToResponse(errorStatusCode, action) {
|
|
252
|
+
return async (ctx, request) => {
|
|
253
|
+
try {
|
|
254
|
+
return await action(ctx, request);
|
|
255
|
+
} catch (error) {
|
|
256
|
+
if (error instanceof ConvexError && typeof error.data === "object" && error.data !== null && "code" in error.data && "message" in error.data) return jsonError(errorStatusCode, convexErrorToBody(error));
|
|
257
|
+
if (error instanceof ConvexError) return new Response(null, {
|
|
258
|
+
status: errorStatusCode,
|
|
259
|
+
statusText: typeof error.data === "string" ? error.data : "Error"
|
|
260
|
+
});
|
|
261
|
+
logError(error);
|
|
262
|
+
return new Response(null, {
|
|
263
|
+
status: 500,
|
|
264
|
+
statusText: "Internal Server Error"
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
/** Parse the request's `Cookie` header into a name-to-value record. */
|
|
270
|
+
function getCookies(request) {
|
|
271
|
+
return parse(request.headers.get("Cookie") ?? "");
|
|
272
|
+
}
|
|
273
|
+
function parseConnectionRuntimeRoute(pathname, routeBase) {
|
|
274
|
+
const runtimePrefix = `${routeBase}/`;
|
|
275
|
+
const [runtimeConnectionId, protocol, ...rest] = pathname.startsWith(runtimePrefix) ? pathname.slice(runtimePrefix.length).split("/").filter(Boolean) : [];
|
|
276
|
+
if (runtimeConnectionId === void 0 || protocol !== "oidc" && protocol !== "saml" && protocol !== "scim" || rest.length === 0) return null;
|
|
277
|
+
return {
|
|
278
|
+
pathname,
|
|
279
|
+
connectionId: runtimeConnectionId,
|
|
280
|
+
protocol,
|
|
281
|
+
rest
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Register the OpenID discovery and JWKS endpoints on an HTTP router.
|
|
286
|
+
*
|
|
287
|
+
* Adds `<routeBase>/.well-known/openid-configuration` and
|
|
288
|
+
* `<routeBase>/.well-known/jwks.json`. OAuth-specific discovery fields are
|
|
289
|
+
* included only when `deps.oauth` is provided.
|
|
290
|
+
*
|
|
291
|
+
* Discovery is served at both the issuer prefix and the root, including the
|
|
292
|
+
* RFC 8414 `oauth-authorization-server` path conventions, because clients
|
|
293
|
+
* treat either the issuer (`/auth`) or the origin as the base. These exact
|
|
294
|
+
* routes win over the static-hosting catch-all, so zero-config
|
|
295
|
+
* `mcp login <url>` resolves to JSON rather than the SPA HTML fallback.
|
|
296
|
+
*/
|
|
297
|
+
function addOpenIdRoutes(http, deps) {
|
|
298
|
+
const cacheControl = "public, max-age=15, stale-while-revalidate=15, stale-if-error=86400";
|
|
299
|
+
const routeBase = deps.routeBase ?? "";
|
|
300
|
+
const buildMetadata = () => {
|
|
301
|
+
const issuer = deps.getIssuer();
|
|
302
|
+
const body = {
|
|
303
|
+
issuer,
|
|
304
|
+
jwks_uri: `${issuer}/.well-known/jwks.json`
|
|
305
|
+
};
|
|
306
|
+
if (deps.oauth) {
|
|
307
|
+
body.authorization_endpoint = `${issuer}/oauth2/authorize`;
|
|
308
|
+
body.token_endpoint = `${issuer}/oauth2/token`;
|
|
309
|
+
body.registration_endpoint = `${issuer}/oauth2/register`;
|
|
310
|
+
body.response_types_supported = ["code"];
|
|
311
|
+
body.grant_types_supported = [
|
|
312
|
+
"authorization_code",
|
|
313
|
+
"refresh_token",
|
|
314
|
+
"client_credentials"
|
|
315
|
+
];
|
|
316
|
+
body.code_challenge_methods_supported = ["S256"];
|
|
317
|
+
body.token_endpoint_auth_methods_supported = [
|
|
318
|
+
"client_secret_post",
|
|
319
|
+
"client_secret_basic",
|
|
320
|
+
"none"
|
|
321
|
+
];
|
|
322
|
+
body.scopes_supported = deps.oauth.scopes ?? [
|
|
323
|
+
"openid",
|
|
324
|
+
"profile",
|
|
325
|
+
"email",
|
|
326
|
+
"offline_access"
|
|
327
|
+
];
|
|
328
|
+
}
|
|
329
|
+
return body;
|
|
330
|
+
};
|
|
331
|
+
const metadataHandler = httpActionGeneric(withCors(async () => {
|
|
332
|
+
return new Response(JSON.stringify(buildMetadata()), {
|
|
333
|
+
status: 200,
|
|
334
|
+
headers: {
|
|
335
|
+
"Content-Type": "application/json",
|
|
336
|
+
"Cache-Control": cacheControl
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}));
|
|
340
|
+
const jwksHandler = httpActionGeneric(withCors(async () => {
|
|
341
|
+
return new Response(deps.getJwks(), {
|
|
342
|
+
status: 200,
|
|
343
|
+
headers: {
|
|
344
|
+
"Content-Type": "application/json",
|
|
345
|
+
"Cache-Control": cacheControl
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}));
|
|
349
|
+
const oidcPaths = new Set([`${routeBase}/.well-known/openid-configuration`, "/.well-known/openid-configuration"]);
|
|
350
|
+
const asPaths = deps.oauth ? new Set([
|
|
351
|
+
`/.well-known/oauth-authorization-server${routeBase}`,
|
|
352
|
+
`${routeBase}/.well-known/oauth-authorization-server`,
|
|
353
|
+
"/.well-known/oauth-authorization-server"
|
|
354
|
+
]) : /* @__PURE__ */ new Set();
|
|
355
|
+
const jwksPaths = new Set([`${routeBase}/.well-known/jwks.json`, "/.well-known/jwks.json"]);
|
|
356
|
+
for (const path of [...oidcPaths, ...asPaths]) http.route({
|
|
357
|
+
path,
|
|
358
|
+
method: "GET",
|
|
359
|
+
handler: metadataHandler
|
|
360
|
+
});
|
|
361
|
+
for (const path of jwksPaths) http.route({
|
|
362
|
+
path,
|
|
363
|
+
method: "GET",
|
|
364
|
+
handler: jwksHandler
|
|
365
|
+
});
|
|
366
|
+
registerCorsPreflight(http, [
|
|
367
|
+
...oidcPaths,
|
|
368
|
+
...asPaths,
|
|
369
|
+
...jwksPaths
|
|
370
|
+
]);
|
|
371
|
+
}
|
|
372
|
+
/** Register root `/.well-known/*` app discovery routes on an HTTP router. */
|
|
373
|
+
function addWellKnownRoutes(http, deps) {
|
|
374
|
+
for (const route of [
|
|
375
|
+
{
|
|
376
|
+
endpoint: "apple-app-site-association",
|
|
377
|
+
path: "/.well-known/apple-app-site-association"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
endpoint: "assetlinks.json",
|
|
381
|
+
path: "/.well-known/assetlinks.json"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
endpoint: "webauthn",
|
|
385
|
+
path: "/.well-known/webauthn"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
endpoint: "change-password",
|
|
389
|
+
path: "/.well-known/change-password"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
endpoint: "security.txt",
|
|
393
|
+
path: "/.well-known/security.txt"
|
|
394
|
+
}
|
|
395
|
+
]) http.route({
|
|
396
|
+
path: route.path,
|
|
397
|
+
method: "GET",
|
|
398
|
+
handler: httpActionGeneric(async () => {
|
|
399
|
+
const result = deps.getResponse(route.endpoint);
|
|
400
|
+
if (result === null) return new Response(null, { status: 404 });
|
|
401
|
+
return new Response(result.body, {
|
|
402
|
+
status: result.status,
|
|
403
|
+
headers: result.headers
|
|
404
|
+
});
|
|
405
|
+
})
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Register the OAuth sign-in and callback routes on an HTTP router.
|
|
410
|
+
*
|
|
411
|
+
* Adds `GET <routeBase>/signin/*` and `GET`/`POST <routeBase>/callback/*`.
|
|
412
|
+
*/
|
|
413
|
+
function addAuthRoutes(http, deps) {
|
|
414
|
+
const routeBase = deps.routeBase ?? "/api/auth";
|
|
415
|
+
const routePrefix = routeBase === "" ? "" : routeBase;
|
|
416
|
+
http.route({
|
|
417
|
+
pathPrefix: `${routePrefix}/signin/`,
|
|
418
|
+
method: "GET",
|
|
419
|
+
handler: httpActionGeneric(deps.handleSignIn)
|
|
420
|
+
});
|
|
421
|
+
const callbackHandler = httpActionGeneric(deps.handleCallback);
|
|
422
|
+
http.route({
|
|
423
|
+
pathPrefix: `${routePrefix}/callback/`,
|
|
424
|
+
method: "GET",
|
|
425
|
+
handler: callbackHandler
|
|
426
|
+
});
|
|
427
|
+
http.route({
|
|
428
|
+
pathPrefix: `${routePrefix}/callback/`,
|
|
429
|
+
method: "POST",
|
|
430
|
+
handler: callbackHandler
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Register the OAuth provider authorize, token, registration, and RFC 7592
|
|
435
|
+
* client-management endpoints on an HTTP router.
|
|
436
|
+
*
|
|
437
|
+
* Adds `GET <base>/oauth2/authorize`, `POST <base>/oauth2/token`,
|
|
438
|
+
* `POST <base>/oauth2/register` (DCR), and `GET`/`PUT`/`DELETE`
|
|
439
|
+
* `<base>/oauth2/register/<client_id>` (management). The exact `register` path
|
|
440
|
+
* serves DCR; the `register/` prefix serves per-client management.
|
|
441
|
+
*/
|
|
442
|
+
function addOAuthProviderRoutes(http, deps) {
|
|
443
|
+
const base = deps.routeBase ?? "";
|
|
444
|
+
const authorizePath = `${base}/oauth2/authorize`;
|
|
445
|
+
const tokenPath = `${base}/oauth2/token`;
|
|
446
|
+
const registerPath = `${base}/oauth2/register`;
|
|
447
|
+
const managePrefix = `${registerPath}/`;
|
|
448
|
+
http.route({
|
|
449
|
+
path: authorizePath,
|
|
450
|
+
method: "GET",
|
|
451
|
+
handler: httpActionGeneric(withCors(deps.handleAuthorize))
|
|
452
|
+
});
|
|
453
|
+
http.route({
|
|
454
|
+
path: tokenPath,
|
|
455
|
+
method: "POST",
|
|
456
|
+
handler: httpActionGeneric(withCors(deps.handleToken))
|
|
457
|
+
});
|
|
458
|
+
http.route({
|
|
459
|
+
path: registerPath,
|
|
460
|
+
method: "POST",
|
|
461
|
+
handler: httpActionGeneric(withCors(deps.handleRegister))
|
|
462
|
+
});
|
|
463
|
+
for (const method of [
|
|
464
|
+
"GET",
|
|
465
|
+
"PUT",
|
|
466
|
+
"DELETE"
|
|
467
|
+
]) http.route({
|
|
468
|
+
pathPrefix: managePrefix,
|
|
469
|
+
method,
|
|
470
|
+
handler: httpActionGeneric(withCors(deps.handleManage))
|
|
471
|
+
});
|
|
472
|
+
http.route({
|
|
473
|
+
pathPrefix: managePrefix,
|
|
474
|
+
method: "OPTIONS",
|
|
475
|
+
handler: corsPreflightHandler
|
|
476
|
+
});
|
|
477
|
+
registerCorsPreflight(http, [
|
|
478
|
+
authorizePath,
|
|
479
|
+
tokenPath,
|
|
480
|
+
registerPath
|
|
481
|
+
]);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Register the group connection runtime routes (SAML, OIDC, SCIM) on a router.
|
|
485
|
+
*
|
|
486
|
+
* Mounts method-specific handlers under `<routeBase>/<connectionId>/<protocol>/...`
|
|
487
|
+
* (plus an optional shared OIDC callback path), dispatching by
|
|
488
|
+
* `${protocol}:${endpoint}` and returning SCIM errors for unmatched
|
|
489
|
+
* `PATCH`/`DELETE` requests.
|
|
490
|
+
*/
|
|
491
|
+
function addConnectionRoutes(http, deps) {
|
|
492
|
+
const routePrefix = `${deps.routeBase}/`;
|
|
493
|
+
const sharedOidcCallbackPath = deps.sharedOidcCallbackPath ? (() => {
|
|
494
|
+
if (/^https?:\/\//.test(deps.sharedOidcCallbackPath)) return new URL(deps.sharedOidcCallbackPath).pathname;
|
|
495
|
+
return deps.sharedOidcCallbackPath.startsWith("/") ? deps.sharedOidcCallbackPath : `/${deps.sharedOidcCallbackPath}`;
|
|
496
|
+
})() : void 0;
|
|
497
|
+
if (sharedOidcCallbackPath) {
|
|
498
|
+
http.route({
|
|
499
|
+
path: sharedOidcCallbackPath,
|
|
500
|
+
method: "GET",
|
|
501
|
+
handler: httpActionGeneric(deps.convertErrorsToResponse(400, async (ctx, request) => deps.handleOidcSharedCallback(ctx, request)))
|
|
502
|
+
});
|
|
503
|
+
http.route({
|
|
504
|
+
path: sharedOidcCallbackPath,
|
|
505
|
+
method: "POST",
|
|
506
|
+
handler: httpActionGeneric(deps.convertErrorsToResponse(400, async (ctx, request) => deps.handleOidcSharedCallback(ctx, request)))
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
const scimRoute = (ctx, request) => deps.handleScimRequest(ctx, request);
|
|
510
|
+
const matchConnectionRoute = (route, handlers) => {
|
|
511
|
+
const endpoint = route?.rest[0];
|
|
512
|
+
if (!route || endpoint === void 0) return null;
|
|
513
|
+
const key = route.protocol === "scim" ? endpoint === "v2" ? "scim:v2" : null : route.rest.length === 1 ? `${route.protocol}:${endpoint}` : null;
|
|
514
|
+
return key ? handlers[key] ?? null : null;
|
|
515
|
+
};
|
|
516
|
+
const connectionRouteHandler = (handlers) => httpActionGeneric(deps.convertErrorsToResponse(400, async (ctx, request) => {
|
|
517
|
+
const route = parseConnectionRuntimeRoute(new URL(request.url).pathname, deps.routeBase);
|
|
518
|
+
const handler = matchConnectionRoute(route, handlers);
|
|
519
|
+
if (!handler || !route) throw new ConvexError({
|
|
520
|
+
code: ErrorCode.INVALID_PARAMETERS,
|
|
521
|
+
message: "Invalid connection runtime path."
|
|
522
|
+
});
|
|
523
|
+
return await handler(ctx, request, route);
|
|
524
|
+
}));
|
|
525
|
+
http.route({
|
|
526
|
+
pathPrefix: routePrefix,
|
|
527
|
+
method: "GET",
|
|
528
|
+
handler: connectionRouteHandler({
|
|
529
|
+
"saml:metadata": deps.handleSamlMetadata,
|
|
530
|
+
"saml:signin": deps.handleSamlSignIn,
|
|
531
|
+
"saml:acs": deps.handleSamlAcs,
|
|
532
|
+
"saml:slo": deps.handleSamlSlo,
|
|
533
|
+
"oidc:signin": deps.handleOidcSignIn,
|
|
534
|
+
"oidc:callback": deps.handleOidcCallback,
|
|
535
|
+
"scim:v2": scimRoute
|
|
536
|
+
})
|
|
537
|
+
});
|
|
538
|
+
http.route({
|
|
539
|
+
pathPrefix: routePrefix,
|
|
540
|
+
method: "POST",
|
|
541
|
+
handler: connectionRouteHandler({
|
|
542
|
+
"saml:acs": deps.handleSamlAcs,
|
|
543
|
+
"saml:slo": deps.handleSamlSlo,
|
|
544
|
+
"oidc:callback": deps.handleOidcCallback,
|
|
545
|
+
"scim:v2": scimRoute
|
|
546
|
+
})
|
|
547
|
+
});
|
|
548
|
+
http.route({
|
|
549
|
+
pathPrefix: routePrefix,
|
|
550
|
+
method: "PUT",
|
|
551
|
+
handler: connectionRouteHandler({ "scim:v2": scimRoute })
|
|
552
|
+
});
|
|
553
|
+
for (const method of ["PATCH", "DELETE"]) http.route({
|
|
554
|
+
pathPrefix: routePrefix,
|
|
555
|
+
method,
|
|
556
|
+
handler: httpActionGeneric(async (ctx, request) => {
|
|
557
|
+
const route = parseConnectionRuntimeRoute(new URL(request.url).pathname, deps.routeBase);
|
|
558
|
+
if (!route || route.protocol !== "scim" || route.rest[0] !== "v2") return deps.scimError(404, "notFound", "SCIM resource not found.");
|
|
559
|
+
return await deps.handleScimRequest(ctx, request);
|
|
560
|
+
})
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
//#endregion
|
|
565
|
+
export { addAuthRoutes, addConnectionRoutes, addOAuthProviderRoutes, addOpenIdRoutes, addWellKnownRoutes, convertErrorsToResponse, createHttpAction, createHttpContext, createHttpRoute, getCookies };
|
|
566
|
+
//# sourceMappingURL=http.js.map
|