localDevelopment<TContext> static method

AuthDeployment<TContext> localDevelopment<TContext>({
  1. required Iterable<AuthProvider> providers,
  2. Iterable<AuthServerPlugin<TContext>> plugins = const [],
  3. Iterable<Uri> trustedOrigins = const [],
  4. AuthLifecycleDelivery<TContext>? lifecycleDelivery,
  5. AuthFrameworkSessionHooks<TContext>? frameworkSessionHooks,
  6. AuthRateLimiter<TContext>? rateLimiter,
  7. String basePath = '/auth',
})

Ephemeral HTTP-friendly settings for local development and tests.

Uses an in-memory store, local-development posture, direct proxy policy, and a development cookie policy with secure: false. trustedOrigins accepts HTTP or HTTPS origins, which are lowercased, deduplicated, and stripped of default ports before storage. Origins with credentials, paths, queries, or fragments throw an ArgumentError. Lifecycle delivery defaults to disabled, and providers and plugins remain caller-supplied.

Implementation

static AuthDeployment<TContext> localDevelopment<TContext>({
  required Iterable<AuthProvider> providers,
  Iterable<AuthServerPlugin<TContext>> plugins = const [],
  Iterable<Uri> trustedOrigins = const [],
  AuthLifecycleDelivery<TContext>? lifecycleDelivery,
  AuthFrameworkSessionHooks<TContext>? frameworkSessionHooks,
  AuthRateLimiter<TContext>? rateLimiter,
  String basePath = '/auth',
}) {
  final origins = _normalizeOrigins(trustedOrigins);
  final delivery =
      lifecycleDelivery ?? const AuthLifecycleDelivery.disabled();
  return AuthDeployment<TContext>.custom(
    options: AuthOptions<TContext>(
      providers: providers.toList(growable: false),
      plugins: _plugins(plugins),
      store: InMemoryAuthStore(),
      storeMode: AuthStoreMode.ephemeral,
      runtimeMode: AuthRuntimeMode.localDevelopment,
      rateLimiter: rateLimiter,
      browserProtection: AuthBrowserProtectionOptions(
        trustedOrigins: origins,
      ),
      cookiePolicy: AuthCookiePolicy.development,
      passwordResetSender: delivery.passwordReset,
      emailChangeSender: delivery.emailChange,
      accountDeletionSender: delivery.accountDeletion,
      frameworkSessionHooks:
          frameworkSessionHooks ?? AuthFrameworkSessionHooks<TContext>(),
      basePath: basePath,
    ),
    configuration: _sessionConfiguration(
      strategy: AuthSessionStrategy.session,
    ),
    proxyPolicy: const AuthProxyPolicy.direct(),
  );
}