clerk-sdk-ruby 6.0.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/clerk/actortokens.rb +10 -10
- data/lib/clerk/admin_portal_link_tokens.rb +10 -10
- data/lib/clerk/agenttasks.rb +10 -10
- data/lib/clerk/allowlistidentifiers.rb +15 -15
- data/lib/clerk/api_keys.rb +40 -40
- data/lib/clerk/betafeatures.rb +10 -10
- data/lib/clerk/billing.rb +52 -52
- data/lib/clerk/blocklistidentifiers.rb +15 -15
- data/lib/clerk/clients.rb +15 -15
- data/lib/clerk/domains.rb +20 -20
- data/lib/clerk/emailaddresses.rb +43 -36
- data/lib/clerk/emailandsmstemplates.rb +6 -6
- data/lib/clerk/emailsmstemplates.rb +21 -21
- data/lib/clerk/enterpriseconnections.rb +35 -35
- data/lib/clerk/instancesettings.rb +60 -60
- data/lib/clerk/invitations.rb +20 -20
- data/lib/clerk/jwks.rb +5 -5
- data/lib/clerk/jwttemplates.rb +25 -25
- data/lib/clerk/m2m.rb +20 -20
- data/lib/clerk/machines.rb +45 -45
- data/lib/clerk/miscellaneous.rb +5 -5
- data/lib/clerk/models/components/algorithm.rb +19 -0
- data/lib/clerk/models/components/{clerkerror_meta.rbi → algorithm.rbi} +2 -2
- data/lib/clerk/models/components/billingpaymentattempt_totals.rb +1 -1
- data/lib/clerk/models/components/clerkerror.rb +1 -1
- data/lib/clerk/models/components/commercecreditledgerresponse.rb +3 -7
- data/lib/clerk/models/components/commercecreditledgerresponse.rbi +0 -2
- data/lib/clerk/models/components/{schemas_commerceperunittotal.rb → commerceperunittotal_2.rb} +2 -2
- data/lib/clerk/models/components/{schemas_commerceperunittotal.rbi → commerceperunittotal_2.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commerceperunittotaltier.rb → commerceperunittotaltier_2.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commerceperunittotaltier.rbi → commerceperunittotaltier_2.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commerceplan.rb → commerceplan_2.rb} +6 -6
- data/lib/clerk/models/components/{schemas_commerceplan.rbi → commerceplan_2.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commerceplan_fee.rb → commerceplan_2_annual_fee.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commerceplan_fee.rbi → commerceplan_2_annual_fee.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_fee.rb → commerceplan_2_annual_monthly_fee.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commerceplan_annual_monthly_fee.rbi → commerceplan_2_annual_monthly_fee.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commerceplan_annual_fee.rb → commerceplan_2_fee.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commerceplan_annual_fee.rbi → commerceplan_2_fee.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commerceplan_object.rb → commerceplan_2_object.rb} +2 -2
- data/lib/clerk/models/components/{clerkerrors_meta.rbi → commerceplan_2_object.rbi} +2 -2
- data/lib/clerk/models/components/commercepricetransitiondetails.rb +1 -1
- data/lib/clerk/models/components/commercepricetransitionresponse.rb +1 -1
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem.rb → commercesubscriptionitem_2.rb} +7 -7
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem.rbi → commercesubscriptionitem_2.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_amount.rb → commercesubscriptionitem_2_amount.rb} +1 -1
- data/lib/clerk/models/components/commercesubscriptionitem_2_amount.rbi +19 -0
- data/lib/clerk/models/components/{schemas_commerceplan_annual_monthly_fee.rb → commercesubscriptionitem_2_annual_fee.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_fee.rbi → commercesubscriptionitem_2_annual_fee.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_annual_fee.rb → commercesubscriptionitem_2_annual_monthly_fee.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_amount.rbi → commercesubscriptionitem_2_annual_monthly_fee.rbi} +2 -2
- data/lib/clerk/models/components/commercesubscriptionitem_2_fee.rb +44 -0
- data/lib/clerk/models/components/commercesubscriptionitem_2_fee.rbi +19 -0
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment.rb → commercesubscriptionitem_2_next_payment.rb} +3 -3
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment.rbi → commercesubscriptionitem_2_next_payment.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_amount.rb → commercesubscriptionitem_2_next_payment_amount.rb} +1 -1
- data/lib/clerk/models/components/commercesubscriptionitem_2_next_payment_amount.rbi +19 -0
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_credits.rb → commercesubscriptionitem_2_next_payment_credits.rb} +3 -3
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_credits.rbi → commercesubscriptionitem_2_next_payment_credits.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_credits_proration.rb → commercesubscriptionitem_2_next_payment_credits_proration.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_credits_proration.rbi → commercesubscriptionitem_2_next_payment_credits_proration.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_discounts.rb → commercesubscriptionitem_2_next_payment_discounts.rb} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_discounts.rbi → commercesubscriptionitem_2_next_payment_discounts.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_discounts_proration.rb → commercesubscriptionitem_2_next_payment_discounts_proration.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_discounts_proration.rbi → commercesubscriptionitem_2_next_payment_discounts_proration.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_payer.rb → commercesubscriptionitem_2_next_payment_payer.rb} +1 -1
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_payer.rbi → commercesubscriptionitem_2_next_payment_payer.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_totals.rb → commercesubscriptionitem_2_next_payment_totals.rb} +3 -3
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_next_payment_totals.rbi → commercesubscriptionitem_2_next_payment_totals.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_object_commercepayer.rb → commercesubscriptionitem_2_object_commercepayer.rb} +2 -2
- data/lib/clerk/models/components/commercesubscriptionitem_2_object_commercepayer.rbi +11 -0
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_object_commerceplan.rb → commercesubscriptionitem_2_object_commerceplan.rb} +2 -2
- data/lib/clerk/models/components/commercesubscriptionitem_2_object_commerceplan.rbi +11 -0
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_object_commercesubscriptionitem.rb → commercesubscriptionitem_2_object_commercesubscriptionitem.rb} +2 -2
- data/lib/clerk/models/components/commercesubscriptionitem_2_object_commercesubscriptionitem.rbi +11 -0
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_plan.rb → commercesubscriptionitem_2_plan.rb} +6 -6
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_plan.rbi → commercesubscriptionitem_2_plan.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_plan_period.rb → commercesubscriptionitem_2_plan_period.rb} +2 -2
- data/lib/clerk/models/components/commercesubscriptionitem_2_plan_period.rbi +11 -0
- data/lib/clerk/models/components/{schemas_commercesubscriptionitem_status.rb → commercesubscriptionitem_2_status.rb} +2 -2
- data/lib/clerk/models/components/commercesubscriptionitem_2_status.rbi +11 -0
- data/lib/clerk/models/components/commercesubscriptionitem_totals.rb +1 -1
- data/lib/clerk/models/components/commercesubscriptionnextpayment.rb +1 -1
- data/lib/clerk/models/components/commercesubscriptionnextpayment_totals.rb +1 -1
- data/lib/clerk/models/components/emailaddress_verification_saml_clerkerror.rb +1 -1
- data/lib/clerk/models/components/enrollment_mode.rb +1 -0
- data/lib/clerk/models/components/enterpriseaccount_verification_oauth_clerkerror.rb +1 -1
- data/lib/clerk/models/components/enterpriseaccount_verification_saml_clerkerror.rb +1 -1
- data/lib/clerk/models/components/enterpriseconnection.rb +6 -2
- data/lib/clerk/models/components/enterpriseconnection.rbi +2 -0
- data/lib/clerk/models/components/{custom_attribute.rb → enterpriseconnection_custom_attribute.rb} +1 -1
- data/lib/clerk/models/components/enterpriseconnection_custom_attribute.rbi +21 -0
- data/lib/clerk/models/components/enterpriseconnection_mode.rb +21 -0
- data/lib/clerk/models/components/enterpriseconnection_mode.rbi +11 -0
- data/lib/clerk/models/components/enterpriseconnection_object.rb +19 -0
- data/lib/clerk/models/components/enterpriseconnection_object.rbi +11 -0
- data/lib/clerk/models/components/enterpriseconnection_saml_connection.rb +5 -1
- data/lib/clerk/models/components/enterpriseconnection_saml_connection.rbi +2 -0
- data/lib/clerk/models/components/externalaccountwithverification_verification_oauth_clerkerror.rb +1 -1
- data/lib/clerk/models/components/{schemas_featureresponse.rb → featureresponse_2.rb} +2 -2
- data/lib/clerk/models/components/{schemas_featureresponse.rbi → featureresponse_2.rbi} +2 -2
- data/lib/clerk/models/components/{schemas_featureresponse_object.rb → featureresponse_2_object.rb} +2 -2
- data/lib/clerk/models/components/featureresponse_2_object.rbi +11 -0
- data/lib/clerk/models/components/instanceprotect.rb +5 -1
- data/lib/clerk/models/components/instanceprotect.rbi +2 -0
- data/lib/clerk/models/components/instancesettings.rb +4 -1
- data/lib/clerk/models/components/login_hint.rb +36 -0
- data/lib/clerk/models/components/login_hint.rbi +15 -0
- data/lib/clerk/models/components/oauthapplicationsettings.rb +17 -1
- data/lib/clerk/models/components/oauthapplicationsettings.rbi +8 -0
- data/lib/clerk/models/components/organizationmembershippublicuserdata.rb +5 -1
- data/lib/clerk/models/components/organizationmembershippublicuserdata.rbi +2 -0
- data/lib/clerk/models/components/payer_commercepayer.rb +1 -1
- data/lib/clerk/models/components/payment_type.rb +1 -0
- data/lib/clerk/models/components/platform.rb +20 -0
- data/lib/clerk/models/components/{samlaccount_meta.rbi → platform.rbi} +2 -2
- data/lib/clerk/models/components/samlaccount_clerkerror.rb +1 -1
- data/lib/clerk/models/components/samlconnection_1.rb +15 -1
- data/lib/clerk/models/components/samlconnection_1.rbi +6 -0
- data/lib/clerk/models/components/samlconnection_2.rb +15 -1
- data/lib/clerk/models/components/samlconnection_2.rbi +6 -0
- data/lib/clerk/models/components/samlconnectionloginhint.rb +36 -0
- data/lib/clerk/models/components/samlconnectionloginhint.rbi +15 -0
- data/lib/clerk/models/components/samlconnectionloginhint_mode.rb +21 -0
- data/lib/clerk/models/components/samlconnectionloginhint_mode.rbi +11 -0
- data/lib/clerk/models/components/scimdirectory.rb +80 -0
- data/lib/clerk/models/components/scimdirectory.rbi +37 -0
- data/lib/clerk/models/components/scimdirectory_custom_attribute.rb +48 -0
- data/lib/clerk/models/components/{custom_attribute.rbi → scimdirectory_custom_attribute.rbi} +2 -2
- data/lib/clerk/models/components/scimdirectory_list.rb +36 -0
- data/lib/clerk/models/components/scimdirectory_list.rbi +15 -0
- data/lib/clerk/models/components/scimdirectory_object.rb +19 -0
- data/lib/clerk/models/components/scimdirectory_object.rbi +11 -0
- data/lib/clerk/models/components/scimgrouprolemapping.rb +64 -0
- data/lib/clerk/models/components/scimgrouprolemapping.rbi +29 -0
- data/lib/clerk/models/components/scimgrouprolemapping_deleted.rb +43 -0
- data/lib/clerk/models/components/scimgrouprolemapping_deleted.rbi +17 -0
- data/lib/clerk/models/components/scimgrouprolemapping_deleted_object.rb +19 -0
- data/lib/clerk/models/components/scimgrouprolemapping_deleted_object.rbi +11 -0
- data/lib/clerk/models/components/scimgrouprolemapping_list.rb +36 -0
- data/lib/clerk/models/components/scimgrouprolemapping_list.rbi +15 -0
- data/lib/clerk/models/components/scimgrouprolemapping_object.rb +19 -0
- data/lib/clerk/models/components/scimgrouprolemapping_object.rbi +11 -0
- data/lib/clerk/models/components/seats.rb +1 -1
- data/lib/clerk/models/components/trusteddevice.rb +72 -0
- data/lib/clerk/models/components/trusteddevice.rbi +33 -0
- data/lib/clerk/models/components/trusteddevice_list.rb +36 -0
- data/lib/clerk/models/components/trusteddevice_list.rbi +15 -0
- data/lib/clerk/models/components/trusteddevice_object.rb +19 -0
- data/lib/clerk/models/components/trusteddevice_object.rbi +11 -0
- data/lib/clerk/models/components/trusteddevice_status.rb +20 -0
- data/lib/clerk/models/components/trusteddevice_status.rbi +11 -0
- data/lib/clerk/models/components/verification_from_oauth_clerkerror.rb +1 -1
- data/lib/clerk/models/components/verification_google_one_tap_clerkerror.rb +1 -1
- data/lib/clerk/models/components.rb +49 -38
- data/lib/clerk/models/errors/clerkerrors.rb +1 -1
- data/lib/clerk/models/operations/createemailaddress_request.rb +7 -1
- data/lib/clerk/models/operations/createemailaddress_request.rbi +2 -0
- data/lib/clerk/models/operations/createenterpriseconnection_login_hint.rb +36 -0
- data/lib/clerk/models/operations/createenterpriseconnection_login_hint.rbi +15 -0
- data/lib/clerk/models/operations/createenterpriseconnection_mode.rb +21 -0
- data/lib/clerk/models/operations/createenterpriseconnection_mode.rbi +11 -0
- data/lib/clerk/models/operations/createenterpriseconnection_saml.rb +5 -1
- data/lib/clerk/models/operations/createenterpriseconnection_saml.rbi +2 -0
- data/lib/clerk/models/operations/createorganizationdomain_requestbody.rb +1 -1
- data/lib/clerk/models/operations/createsamlconnection_login_hint_1.rb +36 -0
- data/lib/clerk/models/operations/createsamlconnection_login_hint_1.rbi +15 -0
- data/lib/clerk/models/operations/createsamlconnection_login_hint_2.rb +36 -0
- data/lib/clerk/models/operations/createsamlconnection_login_hint_2.rbi +15 -0
- data/lib/clerk/models/operations/createsamlconnection_mode_1.rb +21 -0
- data/lib/clerk/models/operations/createsamlconnection_mode_1.rbi +11 -0
- data/lib/clerk/models/operations/createsamlconnection_mode_2.rb +21 -0
- data/lib/clerk/models/operations/createsamlconnection_mode_2.rbi +11 -0
- data/lib/clerk/models/operations/createsamlconnection_requestbody_1.rb +5 -1
- data/lib/clerk/models/operations/createsamlconnection_requestbody_1.rbi +2 -0
- data/lib/clerk/models/operations/createsamlconnection_requestbody_2.rb +5 -1
- data/lib/clerk/models/operations/createsamlconnection_requestbody_2.rbi +2 -0
- data/lib/clerk/models/operations/createscimdirectory_request.rb +44 -0
- data/lib/clerk/models/operations/createscimdirectory_request.rbi +19 -0
- data/lib/clerk/models/operations/createscimdirectory_response.rb +44 -0
- data/lib/clerk/models/operations/createscimdirectory_response.rbi +19 -0
- data/lib/clerk/models/operations/createscimgrouprolemapping_request.rb +36 -0
- data/lib/clerk/models/operations/createscimgrouprolemapping_request.rbi +15 -0
- data/lib/clerk/models/operations/createscimgrouprolemapping_requestbody.rb +42 -0
- data/lib/clerk/models/operations/createscimgrouprolemapping_requestbody.rbi +17 -0
- data/lib/clerk/models/operations/createscimgrouprolemapping_response.rb +44 -0
- data/lib/clerk/models/operations/createscimgrouprolemapping_response.rbi +19 -0
- data/lib/clerk/models/operations/createsignintoken_request.rb +6 -1
- data/lib/clerk/models/operations/createsignintoken_request.rbi +2 -0
- data/lib/clerk/models/operations/deletescimdirectory_request.rb +32 -0
- data/lib/clerk/models/operations/deletescimdirectory_request.rbi +13 -0
- data/lib/clerk/models/operations/deletescimdirectory_response.rb +44 -0
- data/lib/clerk/models/operations/deletescimdirectory_response.rbi +19 -0
- data/lib/clerk/models/operations/deletescimgrouprolemapping_request.rb +36 -0
- data/lib/clerk/models/operations/deletescimgrouprolemapping_request.rbi +15 -0
- data/lib/clerk/models/operations/deletescimgrouprolemapping_response.rb +44 -0
- data/lib/clerk/models/operations/deletescimgrouprolemapping_response.rbi +19 -0
- data/lib/clerk/models/operations/enrollment_mode.rb +5 -0
- data/lib/clerk/models/operations/extendbillingsubscriptionitemfreetrial_response.rb +4 -4
- data/lib/clerk/models/operations/extendbillingsubscriptionitemfreetrial_response.rbi +2 -2
- data/lib/clerk/models/operations/getscimdirectory_request.rb +32 -0
- data/lib/clerk/models/operations/getscimdirectory_request.rbi +13 -0
- data/lib/clerk/models/operations/getscimdirectory_response.rb +44 -0
- data/lib/clerk/models/operations/getscimdirectory_response.rbi +19 -0
- data/lib/clerk/models/operations/group_role_mapping.rb +44 -0
- data/lib/clerk/models/operations/group_role_mapping.rbi +19 -0
- data/lib/clerk/models/operations/listallorganizationdomains_request.rb +2 -1
- data/lib/clerk/models/operations/listorganizationdomains_request.rb +2 -1
- data/lib/clerk/models/operations/listscimdirectories_request.rb +39 -0
- data/lib/clerk/models/operations/listscimdirectories_request.rbi +15 -0
- data/lib/clerk/models/operations/listscimdirectories_response.rb +44 -0
- data/lib/clerk/models/operations/listscimdirectories_response.rbi +19 -0
- data/lib/clerk/models/operations/listscimgrouprolemappings_request.rb +32 -0
- data/lib/clerk/models/operations/listscimgrouprolemappings_request.rbi +13 -0
- data/lib/clerk/models/operations/listscimgrouprolemappings_response.rb +44 -0
- data/lib/clerk/models/operations/listscimgrouprolemappings_response.rbi +19 -0
- data/lib/clerk/models/operations/listusertrusteddevices_request.rb +32 -0
- data/lib/clerk/models/operations/listusertrusteddevices_request.rbi +13 -0
- data/lib/clerk/models/operations/listusertrusteddevices_response.rb +44 -0
- data/lib/clerk/models/operations/listusertrusteddevices_response.rbi +19 -0
- data/lib/clerk/models/operations/mapping.rb +36 -0
- data/lib/clerk/models/operations/mapping.rbi +15 -0
- data/lib/clerk/models/operations/removeuserpassword_request.rb +36 -0
- data/lib/clerk/models/operations/removeuserpassword_request.rbi +15 -0
- data/lib/clerk/models/operations/removeuserpassword_requestbody.rb +32 -0
- data/lib/clerk/models/operations/removeuserpassword_requestbody.rbi +13 -0
- data/lib/clerk/models/operations/removeuserpassword_response.rb +44 -0
- data/lib/clerk/models/operations/removeuserpassword_response.rbi +19 -0
- data/lib/clerk/models/operations/replaceorganizationmetadata_request.rb +36 -0
- data/lib/clerk/models/operations/replaceorganizationmetadata_request.rbi +15 -0
- data/lib/clerk/models/operations/replaceorganizationmetadata_requestbody.rb +38 -0
- data/lib/clerk/models/operations/replaceorganizationmetadata_requestbody.rbi +15 -0
- data/lib/clerk/models/operations/replaceorganizationmetadata_response.rb +44 -0
- data/lib/clerk/models/operations/replaceorganizationmetadata_response.rbi +19 -0
- data/lib/clerk/models/operations/replacescimgrouprolemappings_request.rb +36 -0
- data/lib/clerk/models/operations/replacescimgrouprolemappings_request.rbi +15 -0
- data/lib/clerk/models/operations/replacescimgrouprolemappings_requestbody.rb +32 -0
- data/lib/clerk/models/operations/replacescimgrouprolemappings_requestbody.rbi +13 -0
- data/lib/clerk/models/operations/replacescimgrouprolemappings_response.rb +44 -0
- data/lib/clerk/models/operations/replacescimgrouprolemappings_response.rbi +19 -0
- data/lib/clerk/models/operations/replaceuseremailaddress_identification_status.rb +10 -2
- data/lib/clerk/models/operations/replaceuseremailaddress_requestbody.rb +16 -3
- data/lib/clerk/models/operations/replaceuseremailaddress_requestbody.rbi +2 -0
- data/lib/clerk/models/operations/replaceuserphonenumber_identification_status.rb +10 -2
- data/lib/clerk/models/operations/replaceuserphonenumber_requestbody.rb +9 -2
- data/lib/clerk/models/operations/revokeoauthapplicationtoken_request.rb +36 -0
- data/lib/clerk/models/operations/revokeoauthapplicationtoken_request.rbi +15 -0
- data/lib/clerk/models/operations/revokeoauthapplicationtoken_requestbody.rb +32 -0
- data/lib/clerk/models/operations/revokeoauthapplicationtoken_requestbody.rbi +13 -0
- data/lib/clerk/models/operations/revokeoauthapplicationtoken_response.rb +40 -0
- data/lib/clerk/models/operations/revokeoauthapplicationtoken_response.rbi +17 -0
- data/lib/clerk/models/operations/revokeusertrusteddevice_request.rb +36 -0
- data/lib/clerk/models/operations/revokeusertrusteddevice_request.rbi +15 -0
- data/lib/clerk/models/operations/revokeusertrusteddevice_response.rb +44 -0
- data/lib/clerk/models/operations/revokeusertrusteddevice_response.rbi +19 -0
- data/lib/clerk/models/operations/rotatescimdirectoryapikey_request.rb +32 -0
- data/lib/clerk/models/operations/rotatescimdirectoryapikey_request.rbi +13 -0
- data/lib/clerk/models/operations/rotatescimdirectoryapikey_response.rb +44 -0
- data/lib/clerk/models/operations/rotatescimdirectoryapikey_response.rbi +19 -0
- data/lib/clerk/models/operations/updateemailaddress_requestbody.rb +7 -1
- data/lib/clerk/models/operations/updateemailaddress_requestbody.rbi +2 -0
- data/lib/clerk/models/operations/updateenterpriseconnection_login_hint.rb +36 -0
- data/lib/clerk/models/operations/updateenterpriseconnection_login_hint.rbi +15 -0
- data/lib/clerk/models/operations/updateenterpriseconnection_mode.rb +21 -0
- data/lib/clerk/models/operations/updateenterpriseconnection_mode.rbi +11 -0
- data/lib/clerk/models/operations/updateenterpriseconnection_saml.rb +5 -1
- data/lib/clerk/models/operations/updateenterpriseconnection_saml.rbi +2 -0
- data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_request.rb +17 -1
- data/lib/clerk/models/operations/updateinstanceoauthapplicationsettings_request.rbi +8 -0
- data/lib/clerk/models/operations/updateorganization_requestbody.rb +1 -9
- data/lib/clerk/models/operations/updateorganization_requestbody.rbi +0 -4
- data/lib/clerk/models/operations/updateorganizationdomain_requestbody.rb +1 -1
- data/lib/clerk/models/operations/updatesamlconnection_login_hint.rb +36 -0
- data/lib/clerk/models/operations/updatesamlconnection_login_hint.rbi +15 -0
- data/lib/clerk/models/operations/updatesamlconnection_mode.rb +21 -0
- data/lib/clerk/models/operations/updatesamlconnection_mode.rbi +11 -0
- data/lib/clerk/models/operations/updatesamlconnection_requestbody.rb +5 -1
- data/lib/clerk/models/operations/updatesamlconnection_requestbody.rbi +2 -0
- data/lib/clerk/models/operations/updatescimdirectory_request.rb +36 -0
- data/lib/clerk/models/operations/updatescimdirectory_request.rbi +15 -0
- data/lib/clerk/models/operations/updatescimdirectory_requestbody.rb +49 -0
- data/lib/clerk/models/operations/updatescimdirectory_requestbody.rbi +21 -0
- data/lib/clerk/models/operations/updatescimdirectory_response.rb +44 -0
- data/lib/clerk/models/operations/updatescimdirectory_response.rbi +19 -0
- data/lib/clerk/models/operations/updateuser_requestbody.rb +3 -22
- data/lib/clerk/models/operations/updateuser_requestbody.rbi +0 -6
- data/lib/clerk/models/operations.rb +48 -0
- data/lib/clerk/oauthaccesstokens.rb +5 -5
- data/lib/clerk/oauthapplications.rb +185 -35
- data/lib/clerk/openapiclient.rb +2 -1
- data/lib/clerk/organizationdomains.rb +32 -32
- data/lib/clerk/organizationinvitations.rb +35 -35
- data/lib/clerk/organizationmemberships.rb +25 -25
- data/lib/clerk/organizationpermissions.rb +25 -25
- data/lib/clerk/organizationroles.rb +35 -35
- data/lib/clerk/organizations.rb +221 -56
- data/lib/clerk/phonenumbers.rb +43 -36
- data/lib/clerk/proxy.rb +3 -3
- data/lib/clerk/proxychecks.rb +5 -5
- data/lib/clerk/redirecturls.rb +20 -20
- data/lib/clerk/rolesets.rb +35 -35
- data/lib/clerk/samlconnections.rb +25 -25
- data/lib/clerk/scimdirectories.rb +1531 -0
- data/lib/clerk/sdk.rb +23 -5
- data/lib/clerk/sdkconfiguration.rb +4 -4
- data/lib/clerk/sessions.rb +35 -35
- data/lib/clerk/signintokens.rb +11 -11
- data/lib/clerk/signups.rb +10 -10
- data/lib/clerk/templates.rb +5 -5
- data/lib/clerk/testingtokens.rb +5 -5
- data/lib/clerk/users.rb +695 -204
- data/lib/clerk/utils/retries.rb +43 -1
- data/lib/clerk/waitlistentries.rb +30 -30
- data/lib/clerk/webhooks.rb +15 -15
- data/lib/clerk_sdk_ruby.rb +1 -0
- data/test/clerk/jwks_cache_scoping_test.rb +83 -0
- data/test/clerk/proxy_test.rb +108 -0
- metadata +201 -80
- data/lib/clerk/models/components/clerkerror_meta.rb +0 -27
- data/lib/clerk/models/components/clerkerrors_meta.rb +0 -27
- data/lib/clerk/models/components/emailaddress_verification_saml_meta.rb +0 -27
- data/lib/clerk/models/components/emailaddress_verification_saml_meta.rbi +0 -11
- data/lib/clerk/models/components/enterpriseaccount_verification_oauth_meta.rb +0 -27
- data/lib/clerk/models/components/enterpriseaccount_verification_oauth_meta.rbi +0 -11
- data/lib/clerk/models/components/enterpriseaccount_verification_saml_meta.rb +0 -27
- data/lib/clerk/models/components/enterpriseaccount_verification_saml_meta.rbi +0 -11
- data/lib/clerk/models/components/externalaccountwithverification_verification_oauth_meta.rb +0 -27
- data/lib/clerk/models/components/externalaccountwithverification_verification_oauth_meta.rbi +0 -11
- data/lib/clerk/models/components/samlaccount_meta.rb +0 -27
- data/lib/clerk/models/components/schemas_commerceplan_object.rbi +0 -11
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_annual_fee.rbi +0 -19
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_annual_monthly_fee.rb +0 -44
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_annual_monthly_fee.rbi +0 -19
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_next_payment_amount.rbi +0 -19
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_object_commercepayer.rbi +0 -11
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_object_commerceplan.rbi +0 -11
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_object_commercesubscriptionitem.rbi +0 -11
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_plan_period.rbi +0 -11
- data/lib/clerk/models/components/schemas_commercesubscriptionitem_status.rbi +0 -11
- data/lib/clerk/models/components/schemas_featureresponse_object.rbi +0 -11
- data/lib/clerk/models/components/verification_from_oauth_meta.rb +0 -27
- data/lib/clerk/models/components/verification_from_oauth_meta.rbi +0 -11
- data/lib/clerk/models/components/verification_google_one_tap_meta.rb +0 -27
- data/lib/clerk/models/components/verification_google_one_tap_meta.rbi +0 -11
data/lib/clerk/utils/retries.rb
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
# frozen_string_literal: true
|
|
5
5
|
|
|
6
6
|
require 'faraday/retry'
|
|
7
|
+
require 'time'
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
module Clerk
|
|
@@ -67,16 +68,57 @@ module Clerk
|
|
|
67
68
|
if @strategy == 'backoff' && @backoff
|
|
68
69
|
retry_options[:backoff_factor] = @backoff.exponent unless @backoff.exponent.nil?
|
|
69
70
|
retry_options[:interval] = (@backoff.initial_interval.to_f / 1000) unless @backoff.initial_interval.nil?
|
|
70
|
-
retry_options[:max_interval] = @backoff.max_interval unless @backoff.max_interval.nil?
|
|
71
|
+
retry_options[:max_interval] = (@backoff.max_interval.to_f / 1000) unless @backoff.max_interval.nil?
|
|
71
72
|
|
|
72
73
|
unless @backoff.max_elapsed_time.nil?
|
|
73
74
|
stop_time = initial_time + (@backoff.max_elapsed_time.to_f / 1000)
|
|
74
75
|
retry_options[:retry_if] = ->(_env, _exc) { Time.now < stop_time }
|
|
75
76
|
end
|
|
77
|
+
|
|
76
78
|
end
|
|
77
79
|
|
|
78
80
|
retry_options
|
|
79
81
|
end
|
|
80
82
|
end
|
|
83
|
+
|
|
84
|
+
class RetryMiddleware < Faraday::Retry::Middleware
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def calculate_sleep_amount(retries, env)
|
|
89
|
+
retry_after = [calculate_retry_after(env), calculate_rate_limit_reset(env)].compact.max
|
|
90
|
+
retry_interval = calculate_retry_interval(retries)
|
|
91
|
+
return retry_interval if retry_after.nil?
|
|
92
|
+
|
|
93
|
+
# unlike the stock middleware, cap server delays at max_interval rather
|
|
94
|
+
# than abandoning the retry
|
|
95
|
+
[[retry_after, @options.max_interval].min, retry_interval].max
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
private
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def calculate_retry_after(env)
|
|
102
|
+
response_headers = env[:response_headers]
|
|
103
|
+
return unless response_headers
|
|
104
|
+
|
|
105
|
+
ms_value = response_headers['retry-after-ms']
|
|
106
|
+
return ms_value.to_f / 1000 if ms_value&.match?(/\A\s*\d+\s*\z/)
|
|
107
|
+
|
|
108
|
+
value = response_headers['retry-after']
|
|
109
|
+
return if value.nil? || value.strip.empty?
|
|
110
|
+
return value.to_f if value.match?(/\A\s*\d+\s*\z/)
|
|
111
|
+
|
|
112
|
+
begin
|
|
113
|
+
Time.httpdate(value) - Time.now
|
|
114
|
+
rescue ArgumentError
|
|
115
|
+
begin
|
|
116
|
+
Time.iso8601(value) - Time.now
|
|
117
|
+
rescue ArgumentError
|
|
118
|
+
nil
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
end
|
|
81
123
|
end
|
|
82
124
|
end
|
|
@@ -72,10 +72,10 @@ module Clerk
|
|
|
72
72
|
|
|
73
73
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
74
74
|
timeout ||= @sdk_configuration.timeout
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
|
|
77
77
|
connection = @sdk_configuration.client.dup
|
|
78
|
-
connection.
|
|
78
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
79
79
|
|
|
80
80
|
hook_ctx = SDKHooks::HookContext.new(
|
|
81
81
|
config: @sdk_configuration,
|
|
@@ -88,7 +88,7 @@ module Clerk
|
|
|
88
88
|
error = nil
|
|
89
89
|
http_response = nil
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
begin
|
|
93
93
|
http_response = connection.get(url) do |req|
|
|
94
94
|
req.headers.merge!(headers)
|
|
@@ -125,13 +125,13 @@ module Clerk
|
|
|
125
125
|
response: http_response
|
|
126
126
|
)
|
|
127
127
|
end
|
|
128
|
-
|
|
128
|
+
|
|
129
129
|
if http_response.nil?
|
|
130
130
|
raise error if !error.nil?
|
|
131
131
|
raise 'no response'
|
|
132
132
|
end
|
|
133
133
|
end
|
|
134
|
-
|
|
134
|
+
|
|
135
135
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
136
136
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
137
137
|
if Utils.match_content_type(content_type, 'application/json')
|
|
@@ -205,10 +205,10 @@ module Clerk
|
|
|
205
205
|
|
|
206
206
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
207
207
|
timeout ||= @sdk_configuration.timeout
|
|
208
|
-
|
|
208
|
+
|
|
209
209
|
|
|
210
210
|
connection = @sdk_configuration.client.dup
|
|
211
|
-
connection.
|
|
211
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
212
212
|
|
|
213
213
|
hook_ctx = SDKHooks::HookContext.new(
|
|
214
214
|
config: @sdk_configuration,
|
|
@@ -221,7 +221,7 @@ module Clerk
|
|
|
221
221
|
error = nil
|
|
222
222
|
http_response = nil
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
|
|
225
225
|
begin
|
|
226
226
|
http_response = connection.post(url) do |req|
|
|
227
227
|
req.body = body
|
|
@@ -258,13 +258,13 @@ module Clerk
|
|
|
258
258
|
response: http_response
|
|
259
259
|
)
|
|
260
260
|
end
|
|
261
|
-
|
|
261
|
+
|
|
262
262
|
if http_response.nil?
|
|
263
263
|
raise error if !error.nil?
|
|
264
264
|
raise 'no response'
|
|
265
265
|
end
|
|
266
266
|
end
|
|
267
|
-
|
|
267
|
+
|
|
268
268
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
269
269
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
270
270
|
if Utils.match_content_type(content_type, 'application/json')
|
|
@@ -359,10 +359,10 @@ module Clerk
|
|
|
359
359
|
|
|
360
360
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
361
361
|
timeout ||= @sdk_configuration.timeout
|
|
362
|
-
|
|
362
|
+
|
|
363
363
|
|
|
364
364
|
connection = @sdk_configuration.client.dup
|
|
365
|
-
connection.
|
|
365
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
366
366
|
|
|
367
367
|
hook_ctx = SDKHooks::HookContext.new(
|
|
368
368
|
config: @sdk_configuration,
|
|
@@ -375,7 +375,7 @@ module Clerk
|
|
|
375
375
|
error = nil
|
|
376
376
|
http_response = nil
|
|
377
377
|
|
|
378
|
-
|
|
378
|
+
|
|
379
379
|
begin
|
|
380
380
|
http_response = connection.post(url) do |req|
|
|
381
381
|
req.body = body
|
|
@@ -412,13 +412,13 @@ module Clerk
|
|
|
412
412
|
response: http_response
|
|
413
413
|
)
|
|
414
414
|
end
|
|
415
|
-
|
|
415
|
+
|
|
416
416
|
if http_response.nil?
|
|
417
417
|
raise error if !error.nil?
|
|
418
418
|
raise 'no response'
|
|
419
419
|
end
|
|
420
420
|
end
|
|
421
|
-
|
|
421
|
+
|
|
422
422
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
423
423
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
424
424
|
if Utils.match_content_type(content_type, 'application/json')
|
|
@@ -504,10 +504,10 @@ module Clerk
|
|
|
504
504
|
|
|
505
505
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
506
506
|
timeout ||= @sdk_configuration.timeout
|
|
507
|
-
|
|
507
|
+
|
|
508
508
|
|
|
509
509
|
connection = @sdk_configuration.client.dup
|
|
510
|
-
connection.
|
|
510
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
511
511
|
|
|
512
512
|
hook_ctx = SDKHooks::HookContext.new(
|
|
513
513
|
config: @sdk_configuration,
|
|
@@ -520,7 +520,7 @@ module Clerk
|
|
|
520
520
|
error = nil
|
|
521
521
|
http_response = nil
|
|
522
522
|
|
|
523
|
-
|
|
523
|
+
|
|
524
524
|
begin
|
|
525
525
|
http_response = connection.delete(url) do |req|
|
|
526
526
|
req.headers.merge!(headers)
|
|
@@ -556,13 +556,13 @@ module Clerk
|
|
|
556
556
|
response: http_response
|
|
557
557
|
)
|
|
558
558
|
end
|
|
559
|
-
|
|
559
|
+
|
|
560
560
|
if http_response.nil?
|
|
561
561
|
raise error if !error.nil?
|
|
562
562
|
raise 'no response'
|
|
563
563
|
end
|
|
564
564
|
end
|
|
565
|
-
|
|
565
|
+
|
|
566
566
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
567
567
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
568
568
|
if Utils.match_content_type(content_type, 'application/json')
|
|
@@ -659,10 +659,10 @@ module Clerk
|
|
|
659
659
|
|
|
660
660
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
661
661
|
timeout ||= @sdk_configuration.timeout
|
|
662
|
-
|
|
662
|
+
|
|
663
663
|
|
|
664
664
|
connection = @sdk_configuration.client.dup
|
|
665
|
-
connection.
|
|
665
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
666
666
|
|
|
667
667
|
hook_ctx = SDKHooks::HookContext.new(
|
|
668
668
|
config: @sdk_configuration,
|
|
@@ -675,7 +675,7 @@ module Clerk
|
|
|
675
675
|
error = nil
|
|
676
676
|
http_response = nil
|
|
677
677
|
|
|
678
|
-
|
|
678
|
+
|
|
679
679
|
begin
|
|
680
680
|
http_response = connection.post(url) do |req|
|
|
681
681
|
req.body = body
|
|
@@ -712,13 +712,13 @@ module Clerk
|
|
|
712
712
|
response: http_response
|
|
713
713
|
)
|
|
714
714
|
end
|
|
715
|
-
|
|
715
|
+
|
|
716
716
|
if http_response.nil?
|
|
717
717
|
raise error if !error.nil?
|
|
718
718
|
raise 'no response'
|
|
719
719
|
end
|
|
720
720
|
end
|
|
721
|
-
|
|
721
|
+
|
|
722
722
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
723
723
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
724
724
|
if Utils.match_content_type(content_type, 'application/json')
|
|
@@ -804,10 +804,10 @@ module Clerk
|
|
|
804
804
|
|
|
805
805
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
806
806
|
timeout ||= @sdk_configuration.timeout
|
|
807
|
-
|
|
807
|
+
|
|
808
808
|
|
|
809
809
|
connection = @sdk_configuration.client.dup
|
|
810
|
-
connection.
|
|
810
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
811
811
|
|
|
812
812
|
hook_ctx = SDKHooks::HookContext.new(
|
|
813
813
|
config: @sdk_configuration,
|
|
@@ -820,7 +820,7 @@ module Clerk
|
|
|
820
820
|
error = nil
|
|
821
821
|
http_response = nil
|
|
822
822
|
|
|
823
|
-
|
|
823
|
+
|
|
824
824
|
begin
|
|
825
825
|
http_response = connection.post(url) do |req|
|
|
826
826
|
req.headers.merge!(headers)
|
|
@@ -856,13 +856,13 @@ module Clerk
|
|
|
856
856
|
response: http_response
|
|
857
857
|
)
|
|
858
858
|
end
|
|
859
|
-
|
|
859
|
+
|
|
860
860
|
if http_response.nil?
|
|
861
861
|
raise error if !error.nil?
|
|
862
862
|
raise 'no response'
|
|
863
863
|
end
|
|
864
864
|
end
|
|
865
|
-
|
|
865
|
+
|
|
866
866
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
867
867
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
868
868
|
if Utils.match_content_type(content_type, 'application/json')
|
data/lib/clerk/webhooks.rb
CHANGED
|
@@ -69,10 +69,10 @@ module Clerk
|
|
|
69
69
|
|
|
70
70
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
71
71
|
timeout ||= @sdk_configuration.timeout
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
|
|
74
74
|
connection = @sdk_configuration.client.dup
|
|
75
|
-
connection.
|
|
75
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
76
76
|
|
|
77
77
|
hook_ctx = SDKHooks::HookContext.new(
|
|
78
78
|
config: @sdk_configuration,
|
|
@@ -85,7 +85,7 @@ module Clerk
|
|
|
85
85
|
error = nil
|
|
86
86
|
http_response = nil
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
begin
|
|
90
90
|
http_response = connection.post(url) do |req|
|
|
91
91
|
req.headers.merge!(headers)
|
|
@@ -121,13 +121,13 @@ module Clerk
|
|
|
121
121
|
response: http_response
|
|
122
122
|
)
|
|
123
123
|
end
|
|
124
|
-
|
|
124
|
+
|
|
125
125
|
if http_response.nil?
|
|
126
126
|
raise error if !error.nil?
|
|
127
127
|
raise 'no response'
|
|
128
128
|
end
|
|
129
129
|
end
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
132
132
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
133
133
|
if Utils.match_content_type(content_type, 'application/json')
|
|
@@ -205,10 +205,10 @@ module Clerk
|
|
|
205
205
|
|
|
206
206
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
207
207
|
timeout ||= @sdk_configuration.timeout
|
|
208
|
-
|
|
208
|
+
|
|
209
209
|
|
|
210
210
|
connection = @sdk_configuration.client.dup
|
|
211
|
-
connection.
|
|
211
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
212
212
|
|
|
213
213
|
hook_ctx = SDKHooks::HookContext.new(
|
|
214
214
|
config: @sdk_configuration,
|
|
@@ -221,7 +221,7 @@ module Clerk
|
|
|
221
221
|
error = nil
|
|
222
222
|
http_response = nil
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
|
|
225
225
|
begin
|
|
226
226
|
http_response = connection.delete(url) do |req|
|
|
227
227
|
req.headers.merge!(headers)
|
|
@@ -257,13 +257,13 @@ module Clerk
|
|
|
257
257
|
response: http_response
|
|
258
258
|
)
|
|
259
259
|
end
|
|
260
|
-
|
|
260
|
+
|
|
261
261
|
if http_response.nil?
|
|
262
262
|
raise error if !error.nil?
|
|
263
263
|
raise 'no response'
|
|
264
264
|
end
|
|
265
265
|
end
|
|
266
|
-
|
|
266
|
+
|
|
267
267
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
268
268
|
if Utils.match_status_code(http_response.status, ['204'])
|
|
269
269
|
http_response = @sdk_configuration.hooks.after_success(
|
|
@@ -332,10 +332,10 @@ module Clerk
|
|
|
332
332
|
|
|
333
333
|
timeout = (timeout_ms.to_f / 1000) unless timeout_ms.nil?
|
|
334
334
|
timeout ||= @sdk_configuration.timeout
|
|
335
|
-
|
|
335
|
+
|
|
336
336
|
|
|
337
337
|
connection = @sdk_configuration.client.dup
|
|
338
|
-
connection.
|
|
338
|
+
connection.use Utils::RetryMiddleware, retry_options
|
|
339
339
|
|
|
340
340
|
hook_ctx = SDKHooks::HookContext.new(
|
|
341
341
|
config: @sdk_configuration,
|
|
@@ -348,7 +348,7 @@ module Clerk
|
|
|
348
348
|
error = nil
|
|
349
349
|
http_response = nil
|
|
350
350
|
|
|
351
|
-
|
|
351
|
+
|
|
352
352
|
begin
|
|
353
353
|
http_response = connection.post(url) do |req|
|
|
354
354
|
req.headers.merge!(headers)
|
|
@@ -384,13 +384,13 @@ module Clerk
|
|
|
384
384
|
response: http_response
|
|
385
385
|
)
|
|
386
386
|
end
|
|
387
|
-
|
|
387
|
+
|
|
388
388
|
if http_response.nil?
|
|
389
389
|
raise error if !error.nil?
|
|
390
390
|
raise 'no response'
|
|
391
391
|
end
|
|
392
392
|
end
|
|
393
|
-
|
|
393
|
+
|
|
394
394
|
content_type = http_response.headers.fetch('Content-Type', 'application/octet-stream')
|
|
395
395
|
if Utils.match_status_code(http_response.status, ['200'])
|
|
396
396
|
if Utils.match_content_type(content_type, 'application/json')
|
data/lib/clerk_sdk_ruby.rb
CHANGED
|
@@ -43,6 +43,7 @@ module Clerk
|
|
|
43
43
|
autoload :Billing, 'clerk/billing'
|
|
44
44
|
autoload :OrganizationPermissions, 'clerk/organizationpermissions'
|
|
45
45
|
autoload :RoleSets, 'clerk/rolesets'
|
|
46
|
+
autoload :ScimDirectories, 'clerk/scimdirectories'
|
|
46
47
|
autoload :AdminPortalLinkTokens, 'clerk/admin_portal_link_tokens'
|
|
47
48
|
autoload :APIKeys, 'clerk/api_keys'
|
|
48
49
|
autoload :M2m, 'clerk/m2m'
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'base64'
|
|
4
|
+
require 'faraday'
|
|
5
|
+
require 'faraday/adapter/test'
|
|
6
|
+
require 'json'
|
|
7
|
+
require 'jwt'
|
|
8
|
+
require 'minitest/autorun'
|
|
9
|
+
require 'openssl'
|
|
10
|
+
require_relative '../../lib/clerk'
|
|
11
|
+
|
|
12
|
+
# Regression test for AISEC-84. The JWKS cache was a single class variable
|
|
13
|
+
# shared by every Clerk::SDK in the process, and verify_token performs no
|
|
14
|
+
# issuer check. While the cache held one instance's keys, a token minted by
|
|
15
|
+
# that instance verified against any other instance's SDK.
|
|
16
|
+
class JwksCacheScopingTest < Minitest::Test
|
|
17
|
+
Tenant = Struct.new(:sdk, :token, :fetches)
|
|
18
|
+
|
|
19
|
+
def test_cached_keys_are_not_served_to_another_instance
|
|
20
|
+
tenant_a = build_tenant('tenant_a')
|
|
21
|
+
tenant_b = build_tenant('tenant_b')
|
|
22
|
+
|
|
23
|
+
# A legitimate tenant-B verification loads tenant B's keys.
|
|
24
|
+
claims = tenant_b.sdk.verify_token(tenant_b.token)
|
|
25
|
+
assert_equal 'user_tenant_b', claims['sub']
|
|
26
|
+
assert_equal ['tenant_b'], tenant_b.fetches
|
|
27
|
+
|
|
28
|
+
# The same token under tenant A must not resolve against tenant B's keys.
|
|
29
|
+
assert_raises(JWT::DecodeError) do
|
|
30
|
+
tenant_a.sdk.verify_token(tenant_b.token)
|
|
31
|
+
end
|
|
32
|
+
refute_empty tenant_a.fetches, 'tenant A must fetch its own JWKS'
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def test_scope_differs_per_secret_key
|
|
36
|
+
sdk_a = ::Clerk::SDK.new(secret_key: 'sk_test_a', server_url: 'https://api.clerk.com/v1')
|
|
37
|
+
sdk_b = ::Clerk::SDK.new(secret_key: 'sk_test_b', server_url: 'https://api.clerk.com/v1')
|
|
38
|
+
sdk_a_again = ::Clerk::SDK.new(secret_key: 'sk_test_a', server_url: 'https://api.clerk.com/v1')
|
|
39
|
+
|
|
40
|
+
refute_equal sdk_a.jwks_cache_scope, sdk_b.jwks_cache_scope
|
|
41
|
+
# The cache must still be shared across SDKs for the same instance, since
|
|
42
|
+
# authenticate_request builds a fresh SDK per request.
|
|
43
|
+
assert_equal sdk_a.jwks_cache_scope, sdk_a_again.jwks_cache_scope
|
|
44
|
+
assert_same ::Clerk::SDK.jwks_cache(sdk_a.jwks_cache_scope),
|
|
45
|
+
::Clerk::SDK.jwks_cache(sdk_a_again.jwks_cache_scope)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
|
|
50
|
+
def build_tenant(name)
|
|
51
|
+
key = OpenSSL::PKey::RSA.generate(2048)
|
|
52
|
+
kid = "ins_#{name}"
|
|
53
|
+
jwk = {
|
|
54
|
+
kty: 'RSA', use: 'sig', alg: 'RS256', kid: kid,
|
|
55
|
+
n: b64(key.n.to_s(2)),
|
|
56
|
+
e: b64(key.e.to_s(2))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
fetches = []
|
|
60
|
+
stubs = Faraday::Adapter::Test::Stubs.new
|
|
61
|
+
stubs.get('/v1/jwks') do
|
|
62
|
+
fetches << name
|
|
63
|
+
[200, {'Content-Type' => 'application/json'}, JSON.generate(keys: [jwk])]
|
|
64
|
+
end
|
|
65
|
+
client = Faraday.new { |builder| builder.adapter :test, stubs }
|
|
66
|
+
|
|
67
|
+
sdk = ::Clerk::SDK.new(
|
|
68
|
+
secret_key: "sk_test_#{name}",
|
|
69
|
+
client: client,
|
|
70
|
+
server_url: 'https://api.clerk.com/v1'
|
|
71
|
+
)
|
|
72
|
+
token = JWT.encode(
|
|
73
|
+
{sub: "user_#{name}", exp: Time.now.to_i + 3600},
|
|
74
|
+
key, 'RS256', {kid: kid}
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
Tenant.new(sdk, token, fetches)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def b64(bytes)
|
|
81
|
+
Base64.urlsafe_encode64(bytes, padding: false)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'minitest/autorun'
|
|
4
|
+
require_relative '../../lib/clerk/constants'
|
|
5
|
+
require_relative '../../lib/clerk/proxy'
|
|
6
|
+
|
|
7
|
+
module Clerk
|
|
8
|
+
class ProxyReverificationTest < Minitest::Test
|
|
9
|
+
def proxy(fva:, extra_claims: {})
|
|
10
|
+
claims = {'sub' => 'user_123'}
|
|
11
|
+
claims['fva'] = fva unless fva == :omitted
|
|
12
|
+
Clerk::Proxy.new(session_claims: claims.merge(extra_claims))
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# A policy that both factors satisfy comfortably, so any failure below comes
|
|
16
|
+
# from the 'fva' handling rather than from the ages themselves.
|
|
17
|
+
def lenient
|
|
18
|
+
{after_minutes: 10, level: :second_factor}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# --- omitted 'fva' (AISEC-49) ---------------------------------------------
|
|
22
|
+
|
|
23
|
+
def test_omitted_fva_is_not_reverified
|
|
24
|
+
%i[first_factor second_factor multi_factor].each do |level|
|
|
25
|
+
p = proxy(fva: :omitted)
|
|
26
|
+
refute p.user_reverified?({after_minutes: 10, level: level}),
|
|
27
|
+
"expected level #{level} to be unsatisfied when 'fva' is omitted"
|
|
28
|
+
assert p.user_needs_reverification?({after_minutes: 10, level: level})
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_omitted_fva_fails_every_preset
|
|
33
|
+
[StepUp::Preset::STRICT_MFA, StepUp::Preset::STRICT,
|
|
34
|
+
StepUp::Preset::MODERATE, StepUp::Preset::LAX].each do |preset|
|
|
35
|
+
assert proxy(fva: :omitted).user_needs_reverification?(preset),
|
|
36
|
+
"expected preset #{preset} to require reverification when 'fva' is omitted"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_omitted_fva_yields_to_require_reverification_block
|
|
41
|
+
yielded = false
|
|
42
|
+
proxy(fva: :omitted).user_require_reverification!(StepUp::Preset::STRICT) { yielded = true }
|
|
43
|
+
assert yielded
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def test_explicit_null_fva_is_not_reverified
|
|
47
|
+
refute proxy(fva: nil).user_reverified?(lenient)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# --- well-formed 'fva' ----------------------------------------------------
|
|
51
|
+
|
|
52
|
+
def test_recent_second_factor_satisfies_second_factor_policy
|
|
53
|
+
assert proxy(fva: [0, 0]).user_reverified?({after_minutes: 10, level: :second_factor})
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def test_stale_second_factor_fails_second_factor_policy
|
|
57
|
+
refute proxy(fva: [0, 60]).user_reverified?({after_minutes: 10, level: :second_factor})
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def test_second_factor_policy_falls_back_to_first_when_2fa_not_enabled
|
|
61
|
+
assert proxy(fva: [0, -1]).user_reverified?({after_minutes: 10, level: :second_factor})
|
|
62
|
+
refute proxy(fva: [60, -1]).user_reverified?({after_minutes: 10, level: :second_factor})
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def test_first_factor_not_enabled_fails_levels_that_consult_it
|
|
66
|
+
%i[first_factor multi_factor].each do |level|
|
|
67
|
+
refute proxy(fva: [-1, 0]).user_reverified?({after_minutes: 10, level: level}),
|
|
68
|
+
"expected level #{level} to be unsatisfied when the first factor is not enabled"
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# With 2FA enabled, the :second_factor level rests on the second factor
|
|
73
|
+
# alone and doesn't consult the first. Matches clerk-sdk-go's
|
|
74
|
+
# SessionClaims#NeedsReverification.
|
|
75
|
+
def test_second_factor_level_ignores_first_factor_when_2fa_enabled
|
|
76
|
+
assert proxy(fva: [-1, 0]).user_reverified?({after_minutes: 10, level: :second_factor})
|
|
77
|
+
refute proxy(fva: [-1, 60]).user_reverified?({after_minutes: 10, level: :second_factor})
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def test_multi_factor_requires_both_when_2fa_enabled
|
|
81
|
+
assert proxy(fva: [0, 0]).user_reverified?({after_minutes: 10, level: :multi_factor})
|
|
82
|
+
refute proxy(fva: [0, 60]).user_reverified?({after_minutes: 10, level: :multi_factor})
|
|
83
|
+
refute proxy(fva: [60, 0]).user_reverified?({after_minutes: 10, level: :multi_factor})
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_age_equal_to_policy_window_is_stale
|
|
87
|
+
refute proxy(fva: [10, 10]).user_reverified?({after_minutes: 10, level: :second_factor})
|
|
88
|
+
assert proxy(fva: [9, 9]).user_reverified?({after_minutes: 10, level: :second_factor})
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# --- policy and session guards --------------------------------------------
|
|
92
|
+
|
|
93
|
+
def test_signed_out_session_is_not_reverified
|
|
94
|
+
refute Clerk::Proxy.new(session_claims: nil).user_reverified?(lenient)
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
def test_missing_or_incomplete_policy_is_not_reverified
|
|
98
|
+
[{}, {level: :second_factor}, {after_minutes: 10}].each do |params|
|
|
99
|
+
refute proxy(fva: [0, 0]).user_reverified?(params),
|
|
100
|
+
"expected policy #{params.inspect} to be rejected"
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def test_unrecognized_level_is_not_reverified
|
|
105
|
+
refute proxy(fva: [0, 0]).user_reverified?({after_minutes: 10, level: :third_factor})
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|