diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ffc1ea4..4263552 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -20,6 +20,21 @@ module ApplicationHelper end end + def oidc_env_lines(application, client_secret: nil) + lines = ["OIDC_CLIENT_ID=#{application.client_id}"] + lines << if client_secret + "OIDC_CLIENT_SECRET=#{client_secret}" + elsif application.public_client? + "OIDC_CLIENT_SECRET=" + else + "OIDC_CLIENT_SECRET=" + end + lines << "OIDC_DISCOVERY_URL=#{OidcJwtService.issuer_url}" + lines << "OIDC_PROVIDER_NAME='Clinch'" + lines << "OIDC_REQUIRE_PKCE=#{application.requires_pkce? ? 'true' : 'false'}" + lines + end + def border_class_for(type) case type.to_s when "notice" then "border-green-200 dark:border-green-700" diff --git a/app/views/admin/applications/show.html.erb b/app/views/admin/applications/show.html.erb index 390f5f0..286aff6 100644 --- a/app/views/admin/applications/show.html.erb +++ b/app/views/admin/applications/show.html.erb @@ -26,16 +26,7 @@ <% end %> - <% env_lines = [] %> - <% env_lines << "OIDC_CLIENT_ID=#{flash[:client_id]}" %> - <% if flash[:client_secret] %> - <% env_lines << "OIDC_CLIENT_SECRET=#{flash[:client_secret]}" %> - <% elsif flash[:public_client] %> - <% env_lines << "OIDC_CLIENT_SECRET=" %> - <% end %> - <% env_lines << "OIDC_DISCOVERY_URL=#{OidcJwtService.issuer_url}" %> - <% env_lines << "OIDC_PROVIDER_NAME='Clinch'" %> - <% env_lines << "OIDC_REQUIRE_PKCE=#{@application.requires_pkce? ? 'true' : 'false'}" %> + <% env_lines = oidc_env_lines(@application, client_secret: flash[:client_secret]) %>
@@ -183,6 +174,30 @@
<% end %> +
+
+ + Environment variables + +
+ <% env_lines = oidc_env_lines(@application) %> +
+ + <%= @application.confidential_client? ? "Replace with your saved secret." : "Public client — no secret required." %> + + +
+ +
+
+
<% end %>
Redirect URIs