whirlwind-framework/middleware-oauth2

Whirlwind framework PSR-15 oauth2 middleware

v0.0.3 2022-05-02 18:56 UTC

This package is not auto-updated.

Last update: 2024-10-29 06:31:06 UTC


README

Validates Bearer token in:

  • "Authorization" header (Bearer prefix required)
  • "access_token" query param (Bearer prefix must be omitted)
  • "access_token" field in body (Bearer prefix must be omitted)

Example of usage:

$middleware = $container->get(AuthMiddleware::class);

$app->map('GET', '/api/v1/messages', \App\Api\Action\Message\v1\MessageIndexAction::class)
    ->middleware($middleware->withRequiredScopes(['communication-messages.index']));