From 49243ebca6c7214b141d2c1b4f2ee70baef1f846 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Thu, 7 Oct 2021 16:18:51 +0200
Subject: [PATCH] dbp/relay-keycloak-bundle -> dbp/relay-auth-bundle

Some config keys changed as well since the last update
---
 .env                                    |   5 +-
 composer.json                           |   2 +-
 composer.lock                           | 116 +++++++++++++-----------
 config/bundles.php                      |   4 +-
 config/packages/dbp_relay_auth.yaml     |   8 ++
 config/packages/dbp_relay_keycloak.yaml |   8 --
 symfony.lock                            |  17 ++--
 7 files changed, 84 insertions(+), 76 deletions(-)
 create mode 100644 config/packages/dbp_relay_auth.yaml
 delete mode 100644 config/packages/dbp_relay_keycloak.yaml

diff --git a/.env b/.env
index ba55073..8700a07 100644
--- a/.env
+++ b/.env
@@ -23,9 +23,8 @@ KEYCLOAK_FRONTEND_CLIENT_ID=auth-dev-mw-frontend-local
 # If not empty gets used to check if the access token got issued
 # for this audience ('api-gw' for example)
 KEYCLOAK_AUDIENCE=api-gw
-# Set to true to enable local access token validation, non-local
-# requires a client and secret for remote validation
-KEYCLOAK_LOCAL_VALIDATION=true
+# Set to true to enable remote access token validation
+KEYCLOAK_REMOTE_VALIDATION=false
 KEYCLOAK_CLIENT_ID=
 KEYCLOAK_CLIENT_SECRET=
 
diff --git a/composer.json b/composer.json
index 61d494a..a56895b 100644
--- a/composer.json
+++ b/composer.json
@@ -5,8 +5,8 @@
     "require": {
         "php": "^7.3",
         "brainmaestro/composer-git-hooks": "^2.8",
+        "dbp/relay-auth-bundle": "^0.1.2",
         "dbp/relay-core-bundle": "^0.1.10",
-        "dbp/relay-keycloak-bundle": "^0.1.1",
         "symfony/apache-pack": "^1.0",
         "symfony/console": "^5.2",
         "symfony/dotenv": "^5.2",
diff --git a/composer.lock b/composer.lock
index 30319a5..4869c40 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "40e5f05e6836c6efebf49ca7c37778b9",
+    "content-hash": "ebead725fb54071db3a8f299732686a9",
     "packages": [
         {
             "name": "api-platform/core",
@@ -298,6 +298,55 @@
             ],
             "time": "2021-08-15T20:50:18+00:00"
         },
+        {
+            "name": "dbp/relay-auth-bundle",
+            "version": "v0.1.2",
+            "source": {
+                "type": "git",
+                "url": "https://gitlab.tugraz.at/dbp/relay/dbp-relay-auth-bundle.git",
+                "reference": "3a0e46f0a5fa5dab921087dc422c86505af1d522"
+            },
+            "require": {
+                "dbp/relay-core-bundle": "^0.1.10",
+                "ext-json": "*",
+                "guzzlehttp/guzzle": "^7.0",
+                "kevinrob/guzzle-cache-middleware": "^3.3",
+                "php": "^7.3",
+                "symfony/framework-bundle": "^5.2",
+                "symfony/security-core": "^5.2",
+                "symfony/yaml": "^5.2",
+                "web-token/jwt-easy": "^2.1",
+                "web-token/jwt-signature-algorithm-rsa": "^2.1"
+            },
+            "require-dev": {
+                "brainmaestro/composer-git-hooks": "^2.8",
+                "friendsofphp/php-cs-fixer": "^3.0",
+                "phpstan/phpstan": "^0.12.33",
+                "phpstan/phpstan-phpunit": "^0.12.13",
+                "symfony/browser-kit": "^5.3",
+                "symfony/http-client": "^5.3",
+                "symfony/phpunit-bridge": "^5.2",
+                "vimeo/psalm": "^4.4"
+            },
+            "type": "symfony-bundle",
+            "extra": {
+                "hooks": {
+                    "pre-commit": [
+                        "composer lint"
+                    ]
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Dbp\\Relay\\AuthBundle\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "AGPL-3.0-or-later"
+            ],
+            "time": "2021-10-07T13:49:32+00:00"
+        },
         {
             "name": "dbp/relay-core-bundle",
             "version": "v0.1.16",
@@ -361,47 +410,6 @@
             ],
             "time": "2021-09-13T08:02:44+00:00"
         },
-        {
-            "name": "dbp/relay-keycloak-bundle",
-            "version": "v0.1.1",
-            "source": {
-                "type": "git",
-                "url": "https://gitlab.tugraz.at/dbp/relay/dbp-relay-keycloak-bundle",
-                "reference": "a7f0ade430e4dafacd745ac8acb63df1d1eea600"
-            },
-            "require": {
-                "dbp/relay-core-bundle": "^0.1.10",
-                "ext-json": "*",
-                "guzzlehttp/guzzle": "^7.0",
-                "kevinrob/guzzle-cache-middleware": "^3.3",
-                "php": "^7.3",
-                "symfony/framework-bundle": "^5.2",
-                "symfony/security-core": "^5.2",
-                "symfony/yaml": "^5.2",
-                "web-token/jwt-easy": "^2.1",
-                "web-token/jwt-signature-algorithm-rsa": "^2.1"
-            },
-            "require-dev": {
-                "friendsofphp/php-cs-fixer": "^3.0",
-                "phpstan/phpstan": "^0.12.33",
-                "phpstan/phpstan-phpunit": "^0.12.13",
-                "symfony/browser-kit": "^5.3",
-                "symfony/http-client": "^5.3",
-                "symfony/phpunit-bridge": "^5.2",
-                "vimeo/psalm": "^4.4"
-            },
-            "type": "symfony-bundle",
-            "autoload": {
-                "psr-4": {
-                    "Dbp\\Relay\\KeycloakBundle\\": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "AGPL-3.0-or-later"
-            ],
-            "time": "2021-08-03T09:19:56+00:00"
-        },
         {
             "name": "doctrine/annotations",
             "version": "1.13.2",
@@ -6292,7 +6300,7 @@
         },
         {
             "name": "web-token/jwt-checker",
-            "version": "v2.2.10",
+            "version": "v2.2.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/web-token/jwt-checker.git",
@@ -6348,7 +6356,7 @@
                 "symfony"
             ],
             "support": {
-                "source": "https://github.com/web-token/jwt-checker/tree/v2.2.10"
+                "source": "https://github.com/web-token/jwt-checker/tree/v2.2.11"
             },
             "funding": [
                 {
@@ -6360,7 +6368,7 @@
         },
         {
             "name": "web-token/jwt-core",
-            "version": "v2.2.10",
+            "version": "v2.2.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/web-token/jwt-core.git",
@@ -6424,7 +6432,7 @@
                 "symfony"
             ],
             "support": {
-                "source": "https://github.com/web-token/jwt-core/tree/v2.2.10"
+                "source": "https://github.com/web-token/jwt-core/tree/v2.2.11"
             },
             "funding": [
                 {
@@ -6436,7 +6444,7 @@
         },
         {
             "name": "web-token/jwt-easy",
-            "version": "v2.2.10",
+            "version": "v2.2.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/web-token/jwt-easy.git",
@@ -6509,7 +6517,7 @@
                 "symfony"
             ],
             "support": {
-                "source": "https://github.com/web-token/jwt-easy/tree/v2.2.10"
+                "source": "https://github.com/web-token/jwt-easy/tree/v2.2.11"
             },
             "funding": [
                 {
@@ -6521,7 +6529,7 @@
         },
         {
             "name": "web-token/jwt-encryption",
-            "version": "v2.2.10",
+            "version": "v2.2.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/web-token/jwt-encryption.git",
@@ -6588,7 +6596,7 @@
                 "symfony"
             ],
             "support": {
-                "source": "https://github.com/web-token/jwt-encryption/tree/v2.2.10"
+                "source": "https://github.com/web-token/jwt-encryption/tree/v2.2.11"
             },
             "funding": [
                 {
@@ -6600,7 +6608,7 @@
         },
         {
             "name": "web-token/jwt-signature",
-            "version": "v2.2.10",
+            "version": "v2.2.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/web-token/jwt-signature.git",
@@ -6664,7 +6672,7 @@
                 "symfony"
             ],
             "support": {
-                "source": "https://github.com/web-token/jwt-signature/tree/v2.2.10"
+                "source": "https://github.com/web-token/jwt-signature/tree/v2.2.11"
             },
             "funding": [
                 {
@@ -6676,7 +6684,7 @@
         },
         {
             "name": "web-token/jwt-signature-algorithm-rsa",
-            "version": "v2.2.10",
+            "version": "v2.2.11",
             "source": {
                 "type": "git",
                 "url": "https://github.com/web-token/jwt-signature-algorithm-rsa.git",
@@ -6738,7 +6746,7 @@
                 "symfony"
             ],
             "support": {
-                "source": "https://github.com/web-token/jwt-signature-algorithm-rsa/tree/v2.2.10"
+                "source": "https://github.com/web-token/jwt-signature-algorithm-rsa/tree/v2.2.11"
             },
             "funding": [
                 {
diff --git a/config/bundles.php b/config/bundles.php
index 7e52aa3..f6ae201 100644
--- a/config/bundles.php
+++ b/config/bundles.php
@@ -1,7 +1,5 @@
 <?php
 
-declare(strict_types=1);
-
 return [
     Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
     Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
@@ -12,6 +10,6 @@ return [
     Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
     Nelmio\CorsBundle\NelmioCorsBundle::class => ['all' => true],
     ApiPlatform\Core\Bridge\Symfony\Bundle\ApiPlatformBundle::class => ['all' => true],
-    Dbp\Relay\KeycloakBundle\DbpRelayKeycloakBundle::class => ['all' => true],
+    Dbp\Relay\AuthBundle\DbpRelayAuthBundle::class => ['all' => true],
     Dbp\Relay\CoreBundle\DbpRelayCoreBundle::class => ['all' => true],
 ];
diff --git a/config/packages/dbp_relay_auth.yaml b/config/packages/dbp_relay_auth.yaml
new file mode 100644
index 0000000..590212c
--- /dev/null
+++ b/config/packages/dbp_relay_auth.yaml
@@ -0,0 +1,8 @@
+dbp_relay_auth:
+  server_url: '%env(KEYCLOAK_SERVER_URL)%'
+  realm: '%env(KEYCLOAK_REALM)%'
+  remote_validation_client_id: '%env(KEYCLOAK_CLIENT_ID)%'
+  remote_validation_client_secret: '%env(KEYCLOAK_CLIENT_SECRET)%'
+  required_audience: '%env(KEYCLOAK_AUDIENCE)%'
+  remote_validation: '%env(bool:KEYCLOAK_REMOTE_VALIDATION)%'
+  frontend_client_id: '%env(KEYCLOAK_FRONTEND_CLIENT_ID)%'
diff --git a/config/packages/dbp_relay_keycloak.yaml b/config/packages/dbp_relay_keycloak.yaml
deleted file mode 100644
index 83d0aa9..0000000
--- a/config/packages/dbp_relay_keycloak.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-dbp_relay_keycloak:
-  server_url: '%env(KEYCLOAK_SERVER_URL)%'
-  realm: '%env(KEYCLOAK_REALM)%'
-  client_id: '%env(KEYCLOAK_CLIENT_ID)%'
-  client_secret: '%env(KEYCLOAK_CLIENT_SECRET)%'
-  audience: '%env(KEYCLOAK_AUDIENCE)%'
-  local_validation: '%env(bool:KEYCLOAK_LOCAL_VALIDATION)%'
-  frontend_client_id: '%env(KEYCLOAK_FRONTEND_CLIENT_ID)%'
diff --git a/symfony.lock b/symfony.lock
index 5c25a76..d854926 100644
--- a/symfony.lock
+++ b/symfony.lock
@@ -26,7 +26,7 @@
         "version": "v2.8.5"
     },
     "brick/math": {
-        "version": "0.9.2"
+        "version": "0.9.3"
     },
     "composer/package-versions-deprecated": {
         "version": "1.11.99.1"
@@ -37,6 +37,9 @@
     "composer/xdebug-handler": {
         "version": "1.4.4"
     },
+    "dbp/relay-auth-bundle": {
+        "version": "v0.1.1"
+    },
     "dbp/relay-core-bundle": {
         "version": "v0.1.10"
     },
@@ -551,22 +554,22 @@
         "version": "3.18.2"
     },
     "web-token/jwt-checker": {
-        "version": "v2.2.10"
+        "version": "v2.2.11"
     },
     "web-token/jwt-core": {
-        "version": "v2.2.10"
+        "version": "v2.2.11"
     },
     "web-token/jwt-easy": {
-        "version": "v2.2.10"
+        "version": "v2.2.11"
     },
     "web-token/jwt-encryption": {
-        "version": "v2.2.10"
+        "version": "v2.2.11"
     },
     "web-token/jwt-signature": {
-        "version": "v2.2.10"
+        "version": "v2.2.11"
     },
     "web-token/jwt-signature-algorithm-rsa": {
-        "version": "v2.2.10"
+        "version": "v2.2.11"
     },
     "webmozart/assert": {
         "version": "1.9.1"
-- 
GitLab