From c4f8c187e785cee6f75895e6cd52b0ae9a6d4593 Mon Sep 17 00:00:00 2001 From: panteliselef Date: Wed, 20 Nov 2024 12:34:01 -0500 Subject: [PATCH] Align reverification names with other sdks --- lib/clerk/authenticatable.rb | 2 +- lib/clerk/constants.rb | 2 +- lib/clerk/rack_middleware_v2.rb | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/clerk/authenticatable.rb b/lib/clerk/authenticatable.rb index 242302f..88c7f12 100644 --- a/lib/clerk/authenticatable.rb +++ b/lib/clerk/authenticatable.rb @@ -78,7 +78,7 @@ def clerk_user_needs_reverification?(params=StepUp::PRESETS[:strict]) end def clerk_render_reverification(missing_config=nil) - payload = request.env['clerk'].reverification_mismatch_payload(missing_config) + payload = request.env['clerk'].reverification_error_payload(missing_config) render status: 403, json: payload end diff --git a/lib/clerk/constants.rb b/lib/clerk/constants.rb index 968b08a..701fdfa 100644 --- a/lib/clerk/constants.rb +++ b/lib/clerk/constants.rb @@ -1,7 +1,7 @@ module Clerk module StepUp PRESETS = { - very_strict: { after_minutes: 10, level: :multi_factor }, + strict_mfa: { after_minutes: 10, level: :multi_factor }, strict: { after_minutes: 10, level: :second_factor }, moderate: { after_minutes: 60, level: :second_factor }, lax: { after_minutes: 1440, level: :second_factor } diff --git a/lib/clerk/rack_middleware_v2.rb b/lib/clerk/rack_middleware_v2.rb index 16b19ec..dbf8529 100644 --- a/lib/clerk/rack_middleware_v2.rb +++ b/lib/clerk/rack_middleware_v2.rb @@ -87,11 +87,11 @@ def is_user_reverified?(params) end end - def reverification_mismatch_payload(missing_config) + def reverification_error_payload(missing_config) { clerk_error: { type: "forbidden", - reason: "reverification-mismatch", + reason: "reverification-error", metadata: { reverification: missing_config, } } } @@ -101,7 +101,7 @@ def reverification_response(missing_config=nil) [ 403, { "Content-Type" => "application/json" }, - [reverification_mismatch_payload(missing_config).to_json], + [reverification_error_payload(missing_config).to_json], ] end