From 2d58c86eaed0279abe758fbb0f2ad21de65d23d9 Mon Sep 17 00:00:00 2001 From: Christoph Reiter <reiter.christoph@gmail.com> Date: Mon, 14 Nov 2022 16:10:16 +0100 Subject: [PATCH] config: add a new "frontend_client_id" and deprecate all keycloak ones The core bundle will now extract the keycloak specifics from the main server URL at runtime in the frontend. This means we no longer have to expose keycloak specific options here. --- src/DependencyInjection/Configuration.php | 12 ++++++++++-- src/DependencyInjection/DbpRelayAuthExtension.php | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 36f7340..2e95a61 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -46,17 +46,25 @@ class Configuration implements ConfigurationInterface ->example('mysecret') ->end() - // API docs. This is still Keycloak specific because we only have a keycloak - // web component right now. + // API Frontend (API docs etc) + ->scalarNode('frontend_client_id') + ->info('The client ID for the OIDC client (authorization code flow) used for API docs and other frontends provided by the API itself') + ->example('client-docs') + ->end() + + // [DEPRECATED] ->scalarNode('frontend_keycloak_server') + ->setDeprecated('dbp/relay-auth-bundle', '0.1.12', 'No longer needed') ->info('The Keycloak server base URL') ->example('https://keycloak.example.com/auth') ->end() ->scalarNode('frontend_keycloak_realm') + ->setDeprecated('dbp/relay-auth-bundle', '0.1.12', 'No longer needed') ->info('The keycloak realm') ->example('client-docs') ->end() ->scalarNode('frontend_keycloak_client_id') + ->setDeprecated('dbp/relay-auth-bundle', '0.1.12', 'Use "frontend_client_id" instead') ->info('The ID for the keycloak client (authorization code flow) used for API docs or similar') ->example('client-docs') ->end() diff --git a/src/DependencyInjection/DbpRelayAuthExtension.php b/src/DependencyInjection/DbpRelayAuthExtension.php index 0b6e058..b5f1442 100644 --- a/src/DependencyInjection/DbpRelayAuthExtension.php +++ b/src/DependencyInjection/DbpRelayAuthExtension.php @@ -39,6 +39,8 @@ class DbpRelayAuthExtension extends ConfigurableExtension implements PrependExte { $config = $container->getExtensionConfig($this->getAlias())[0]; $this->extendArrayParameter($container, 'dbp_api.twig_globals', [ + 'oidc_server_url' => $config['server_url'] ?? '', + 'oidc_frontend_client_id' => $config['frontend_client_id'] ?? '', 'keycloak_server_url' => $config['frontend_keycloak_server'] ?? '', 'keycloak_realm' => $config['frontend_keycloak_realm'] ?? '', 'keycloak_frontend_client_id' => $config['frontend_keycloak_client_id'] ?? '', -- GitLab