diff --git a/.env b/.env index 303d9c0..c360865 100644 --- a/.env +++ b/.env @@ -52,3 +52,13 @@ OAUTH_ENCRYPTION_KEY=f1b7c279f7992205a0df45e295d07066 ###> nelmio/cors-bundle ### CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$' ###< nelmio/cors-bundle ### + +###> symfony/mercure-bundle ### +# See https://symfony.com/doc/current/mercure.html#configuration +# The URL of the Mercure hub, used by the app to publish updates (can be a local URL) +MERCURE_URL=https://example.com/.well-known/mercure +# The public URL of the Mercure hub, used by the browser to connect +MERCURE_PUBLIC_URL=https://example.com/.well-known/mercure +# The secret used to sign the JWTs +MERCURE_JWT_SECRET="!ChangeThisMercureHubJWTSecretKey!" +###< symfony/mercure-bundle ### diff --git a/composer.json b/composer.json index f5cf73d..a7c56a0 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "php": ">=8.2", "ext-ctype": "*", "ext-iconv": "*", + "ext-openssl": "*", "doctrine/dbal": "^3", "doctrine/doctrine-bundle": "^2.14", "doctrine/doctrine-migrations-bundle": "^3.4", @@ -27,6 +28,7 @@ "symfony/http-client": "7.2.*", "symfony/intl": "7.2.*", "symfony/mailer": "7.2.*", + "symfony/mercure-bundle": "^0.3.9", "symfony/mime": "7.2.*", "symfony/monolog-bundle": "^3.0", "symfony/notifier": "7.2.*", @@ -47,8 +49,7 @@ "symfony/web-link": "7.2.*", "symfony/yaml": "7.2.*", "twig/extra-bundle": "^2.12|^3.0", - "twig/twig": "^2.12|^3.0", - "ext-openssl": "*" + "twig/twig": "^2.12|^3.0" }, "config": { "allow-plugins": { diff --git a/config/bundles.php b/config/bundles.php index 5552afd..1f80250 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -17,4 +17,5 @@ return [ Symfony\UX\Icons\UXIconsBundle::class => ['all' => true], League\Bundle\OAuth2ServerBundle\LeagueOAuth2ServerBundle::class => ['all' => true], Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true], + Symfony\Bundle\MercureBundle\MercureBundle::class => ['all' => true], ]; diff --git a/config/packages/mercure.yaml b/config/packages/mercure.yaml new file mode 100644 index 0000000..f2a7395 --- /dev/null +++ b/config/packages/mercure.yaml @@ -0,0 +1,8 @@ +mercure: + hubs: + default: + url: '%env(MERCURE_URL)%' + public_url: '%env(MERCURE_PUBLIC_URL)%' + jwt: + secret: '%env(MERCURE_JWT_SECRET)%' + publish: '*' diff --git a/src/Entity/AccessToken.php b/src/Entity/AccessToken.php index 7940fa8..ff51556 100644 --- a/src/Entity/AccessToken.php +++ b/src/Entity/AccessToken.php @@ -3,13 +3,11 @@ namespace App\Entity; use DateTimeImmutable; -use Doctrine\ORM\EntityManagerInterface; use League\OAuth2\Server\Entities\AccessTokenEntityInterface; use League\OAuth2\Server\Entities\Traits\AccessTokenTrait; use League\OAuth2\Server\Entities\Traits\EntityTrait; use League\OAuth2\Server\Entities\Traits\TokenEntityTrait; -use App\Repository\UsersOrganizationsRepository; -use lcobucci\JWT; + final class AccessToken implements AccessTokenEntityInterface {