-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(authentication): create authentications to fallback to ApiKeyAuth if AdminApiAuth fails #7744
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…h if AdminApiAuth fails
Changed Files
|
ThisIsMani
previously approved these changes
Apr 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor concerns.
ThisIsMani
previously approved these changes
Apr 7, 2025
SanchithHegde
approved these changes
Apr 7, 2025
ThisIsMani
approved these changes
Apr 8, 2025
tsdk02
added a commit
that referenced
this pull request
Apr 8, 2025
…h if AdminApiAuth fails (#7744) Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Merged
14 tasks
pixincreate
added a commit
that referenced
this pull request
Apr 10, 2025
…acilitapay-pix-pmt * 'main' of github.com:juspay/hyperswitch: (21 commits) chore(version): 2025.04.10.0 refactor(connector): [STRIPE] Remove sofort bank redirect from stripe (#7733) feat(connector): Add invoice number and email in AuthorizeDotNet connector (#7726) fix(router): fix retry_count and add validation for process_tracker (#7614) feat(payment_link): expose configurations for payment links (#7742) chore(version): 2025.04.09.0 chore(postman): update Postman collection files feat(connector): [AIRWALLEX, ELAVON, NOVALNET, XENDIT] add in feature API (#7163) refactor: move merchant_key_store table to accounts schema (#7746) chore(postman): update `Stripe` response `status`, `error_code`, and `error_message` for deprecated `Sofort` (#7730) feat(connector): Add recovery support for recurly [v2] (#7497) refactor(cypress): update BOA configs for manual payments' refunds and connector agnostic (#7690) feat(router): Support `card` in `payment_method_subtype` [V2] (#7662) feat: Add open API reference for Intelligent router (#7727) ci(cypress-ci): remove wise payout from running in github ci (#7756) feat(authentication): create authentications to fallback to ApiKeyAuth if AdminApiAuth fails (#7744) chore(version): 2025.04.08.0 feat(core): added force_3ds_challenge for decoupled txns (#7484) chore(version): 2025.04.07.0 chore(postman): update Postman collection files ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
This PR introduces two new authentication mechanisms that enhance the existing
AdminApiAuth
andAdminApiAuthWithMerchantIdFromRoute
by allowing fallback to regular API key-based authentication when the admin key check fails.1.
AdminApiAuthWithApiKeyFallback
admin_api_key
api-key
merchant_id
matches the configuredfallback_merchant_id
from the merchant_ids set.2.
AdminApiAuthWithApiKeyFallbackWithMerchant
AuthenticationData
)admin_api_key
— on success, loadsAuthenticationData
api-key
merchant_id
fromapi-key
also matches the configuredfallback_merchant_id
from the merchant_ids set.AuthenticationData
Additional Changes
Motivation and Context
Some internal routes currently rely on
AdminApiAuth
using a sharedadmin_api_key
. However, there are scenarios where we want to allow scoped access using anapi-key
associated with a specific merchant — only if it matches a configured fallback merchant from the merchant_ids set.How did you test it?
The following APIs need to be validated with
Tested by setting the ENV through
ROUTER__FALLBACK_MERCHANT_IDS_API_KEY_AUTH__MERCHANT_IDS="merchant_1744036688, merchant_1744037289" cargo run
And also tested by specifying the values in the TOML file.
Merchant Account - Create
Merchant Account - Retrieve
Merchant Account - Update
API Key - Create
API Key - Retrieve
API Key - Update
API Key - List
Merchant Account - List
Checklist
cargo +nightly fmt --all
cargo clippy