From dc4ece1b9d237d6f13858e0fd325239b30614181 Mon Sep 17 00:00:00 2001 From: George Jahad Date: Mon, 21 Oct 2024 13:17:19 -0700 Subject: [PATCH] fixed issuer --- app/lib/clients/vault/oidc.rb | 4 ++-- app/lib/utils/oidc_provider.rb | 2 +- config/application.rb | 2 +- test/lib/clients/oidc_provider_test.rb | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/lib/clients/vault/oidc.rb b/app/lib/clients/vault/oidc.rb index 980cbc1..ac1dd36 100644 --- a/app/lib/clients/vault/oidc.rb +++ b/app/lib/clients/vault/oidc.rb @@ -24,8 +24,8 @@ def get_oidc_client_config def create_client_config(issuer, client_id, client_secret) client.logical.write("/sys/auth/oidc", type: "oidc") client.logical.write("auth/oidc/config", - oidc_discovery_url: issuer, - oidc_discovery_ca_pem: File.read(Config[:oidc_provider_ssl_cert]), + oidc_discovery_url: issuer, + oidc_discovery_ca_pem: File.read(Config[:oidc_provider_ssl_cert]), oidc_client_id: client_id, oidc_client_secret: client_secret, default_role: "default") diff --git a/app/lib/utils/oidc_provider.rb b/app/lib/utils/oidc_provider.rb index 286b8de..9c8c539 100644 --- a/app/lib/utils/oidc_provider.rb +++ b/app/lib/utils/oidc_provider.rb @@ -28,7 +28,7 @@ def get_info vault_client.logical.read("identity/oidc/provider/astral") end - def get_issuer + def self.get_configured_issuer Config[:oidc_provider_addr] + Config[:oidc_issuer_path] end diff --git a/config/application.rb b/config/application.rb index 3265dbb..6e4d80c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -41,7 +41,7 @@ class Application < Rails::Application Clients::Vault.configure_kv Clients::Vault.configure_pki get_oidc_config - issuer = OidcProvider.new.get_issuer + issuer = OidcProvider.get_configured_issuer Clients::Vault.configure_as_oidc_client(issuer, config.astral.oidc_client_id, config.astral.oidc_client_secret) diff --git a/test/lib/clients/oidc_provider_test.rb b/test/lib/clients/oidc_provider_test.rb index 69996a5..9a2acac 100644 --- a/test/lib/clients/oidc_provider_test.rb +++ b/test/lib/clients/oidc_provider_test.rb @@ -10,8 +10,8 @@ class OidcProviderTest < ActiveSupport::TestCase assert_equal "email", @info.data[:scopes_supported][0] end - test ".get_issuer returns correct issuer" do - issuer = @provider.get_issuer + test "#get_issuer returns correct issuer" do + issuer = OidcProvider.get_configured_issuer assert_equal @info.data[:issuer], issuer end