routed_auth 0.2.0 copy "routed_auth: ^0.2.0" to clipboard
routed_auth: ^0.2.0 copied to clipboard

Routed-specific authentication integration package built on top of server_auth.

routed_auth #

Routed-specific auth integration on top of server_auth.

This package contains the HTTP/session/router glue for auth in Routed:

  • AuthServiceProvider
  • AuthRoutes
  • AuthManager
  • SessionAuth + guard middleware
  • Routed JWT/OAuth middleware wrappers
  • Haigate middleware bridge

Use this when you want auth routes and middleware in a Routed app.

Install #

dependencies:
  routed: ^0.4.0
  server_auth: ^0.1.0
  routed_auth: ^0.1.0

Usage #

import 'package:routed/routed.dart';
import 'package:server_auth/server_auth.dart';

void main() async {
  registerRoutedProviders();
  // Engine.create initializes routed.auth and the other official providers.
  final engine = await Engine.create();

  // Example runtime options.
  engine.instance<AuthOptions<EngineContext>>(
    AuthOptions<EngineContext>(
      adapter: AuthAdapter(),
      providers: const <AuthProvider>[],
    ),
  );

  engine.get(
    '/account',
    (ctx) => ctx.json({'authenticated': true}),
    middlewares: [requireAuthenticated()],
  );

  await engine.serve(port: 8080);
}

For a slim composition, import routed_auth directly and add AuthServiceProvider() after Engine.defaultProviders. Add typed provider instances to AuthOptions.providers; no auth provider registry or configuration manifest is required.

0
likes
80
points
592
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Routed-specific authentication integration package built on top of server_auth.

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

crypto, http, pointycastle, routed_core, routed_http, routed_sessions, routed_views, server_auth, server_sessions

More

Packages that depend on routed_auth