stablekernel / aqueduct

Dart HTTP server framework for building REST APIs. Includes PostgreSQL ORM and OAuth2 provider.
https://aqueduct.io
BSD 2-Clause "Simplified" License
2.42k stars 280 forks source link

Require token only in GET request #925

Open fernando-s97 opened 3 years ago

fernando-s97 commented 3 years ago

I have the following routes

router
      ..route("/graduates/auth/token").link(() => AuthController(authServer))
      ..route("/graduates[/:username]")
          .link(() => Authorizer.bearer(authServer))
          .link(() => GraduateController(context, authServer));

The GraduateController handles both GET and POST operations.

How can I make the Authorizer "only works when the operation is GET"? I want to be able to fetch specific data only with authentication, but I want to allow anyone to add data.

WinXaito commented 3 years ago

+1