From 4c5ac344bd370af61186e0b9126605f299784ea9 Mon Sep 17 00:00:00 2001 From: Dan Milne Date: Tue, 4 Nov 2025 20:14:41 +1100 Subject: [PATCH] Bug updating OIDC apps. Update readme --- README.md | 20 ++++++++- app/models/application.rb | 2 +- .../totp/regenerate_backup_codes.html.erb | 45 +++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 app/views/totp/regenerate_backup_codes.html.erb diff --git a/README.md b/README.md index 690a4be..77d85a3 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,25 @@ > [!NOTE] > This software is experiemental. If you'd like to try it out, find bugs, security flaws and improvements, please do. -**A lightweight, self-hosted identity & SSO portal** +**A lightweight, self-hosted identity & SSO / IpD portal** -Clinch gives you one place to manage users and lets any web app authenticate against it without maintaining its own user table. +Clinch gives you one place to manage users and lets any web app authenticate against it without maintaining its own user table. + +I've completed all planned features: + +* Create Admin user on first login +* TOTP ( QR Code ) 2FA, with backup codes ( encrypted at rest ) +* Passkey generation and login, with detection of Passkey during login +* Forward Auth configured and working +* OIDC provider with auto discovery working +* Invite users by email, assign to groups +* Self managed password reset by email +* Use Groups to assign Applications ( Family group can access Kavita, Developers can access Gitea ) +* Configurable Group and User custom claims for OIDC token +* Display all Applications available to the user on their Dashboard +* Display all logged in sessions and OIDC logged in sessions + +What remains now is ensure test coverage, ## Why Clinch? diff --git a/app/models/application.rb b/app/models/application.rb index d4a44b2..9204b5a 100644 --- a/app/models/application.rb +++ b/app/models/application.rb @@ -13,7 +13,7 @@ class Application < ApplicationRecord validates :app_type, presence: true, inclusion: { in: %w[oidc forward_auth] } validates :client_id, uniqueness: { allow_nil: true } - validates :client_secret, presence: true, if: :oidc? + validates :client_secret, presence: true, if: -> { oidc? && client_secret_changed? } validates :domain_pattern, presence: true, uniqueness: { case_sensitive: false }, if: :forward_auth? validates :landing_url, format: { with: URI::regexp(%w[http https]), allow_nil: true, message: "must be a valid URL" } diff --git a/app/views/totp/regenerate_backup_codes.html.erb b/app/views/totp/regenerate_backup_codes.html.erb new file mode 100644 index 0000000..1943b59 --- /dev/null +++ b/app/views/totp/regenerate_backup_codes.html.erb @@ -0,0 +1,45 @@ +
+
+

Regenerate Backup Codes

+

+ This will invalidate all existing backup codes and generate new ones. +

+
+ +
+
+
+
+ + + +
+

Important Security Notice

+

All your current backup codes will become invalid after this action. Make sure you're ready to save the new codes.

+
+
+
+ + <%= form_with(url: create_new_backup_codes_totp_path, method: :post, class: "space-y-6") do |form| %> +
+ <%= form.label :password, "Enter your password to confirm", class: "block text-sm font-medium text-gray-700" %> +
+ <%= form.password_field :password, required: true, + class: "block w-full appearance-none rounded-md border border-gray-300 px-3 py-2 placeholder-gray-400 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-blue-500 sm:text-sm" %> +
+

+ This is required to verify your identity before regenerating backup codes. +

+
+ +
+ <%= form.submit "Generate New Backup Codes", + class: "inline-flex justify-center rounded-md border border-transparent bg-blue-600 py-2 px-4 text-sm font-medium text-white shadow-sm hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2" %> + + <%= link_to "Cancel", profile_path, + class: "inline-flex justify-center rounded-md border border-gray-300 bg-white py-2 px-4 text-sm font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2" %> +
+ <% end %> +
+
+
\ No newline at end of file