Skip to content

Commit

Permalink
don't refresh the provider unnecessarily
Browse files Browse the repository at this point in the history
  • Loading branch information
George Jahad committed Oct 11, 2024
1 parent 289dea6 commit 87a56aa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/lib/clients/vault/oidc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,23 @@
Note that this provider is only meant to be used in our dev/test
environment to excercise the client. In a prod env, a real OIDC
provider is configured in.
provider is configured in config/astral.yml
=end
module Clients
class Vault
module Oidc
cattr_accessor :provider
def configure_oidc_provider
if oidc_provider.logical.read("identity/oidc/provider/astral").nil?
provider = oidc_provider.logical.read("identity/oidc/provider/astral")
if provider.nil?
create_provider_webapp
create_provider_with_email_scope
create_entity_for_initial_user
create_userpass_for_initial_user
map_userpass_to_entity
else
set_client_id
end
end

Expand Down Expand Up @@ -74,6 +77,10 @@ def create_provider_webapp
WEBAPP_NAME,
redirect_uris: redirect_uris,
assignments: "allow_all")
set_client_id
end

def set_client_id
app = oidc_provider.logical.read(WEBAPP_NAME)
@@client_id = app.data[:client_id]
@@client_secret = app.data[:client_secret]
Expand Down

0 comments on commit 87a56aa

Please sign in to comment.