Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align reverification names with other sdks #73

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/clerk/authenticatable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/clerk/constants.rb
Original file line number Diff line number Diff line change
@@ -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 }
Expand Down
6 changes: 3 additions & 3 deletions lib/clerk/rack_middleware_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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, }
}
}
Expand All @@ -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

Expand Down
Loading