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

feat(auth): Add support for partial-auth, by facilitating injection of authentication parameters in headers #4802

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

NishantJoshi00
Copy link
Member

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Adding a wrapper over ApiKeyAuth and PublishableKeyAuth that provides an alternative to allow authentication being done outside the application. This is done by allowing the external entity (most likely a reverse proxy) to send the parameters necessary for the authentication of the request, there by reducing the need to perform db calls and improving the performance of the service.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

image

Using a dummy service to generate a request and header parameters, and sending this parameter to the hyperswitch application without api-key and getting authenticated for the request.

image

Here, you can see that the request was successful, but the payment failed. There by showcasing that the request was authenticated successfully.

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@NishantJoshi00 NishantJoshi00 requested review from a team as code owners May 29, 2024 06:40
@NishantJoshi00 NishantJoshi00 self-assigned this May 29, 2024
@NishantJoshi00 NishantJoshi00 added A-framework Area: Framework A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels May 29, 2024
crates/masking/src/secret.rs Outdated Show resolved Hide resolved
crates/masking/src/secret.rs Outdated Show resolved Hide resolved
crates/common_utils/src/crypto.rs Outdated Show resolved Hide resolved
crates/router/src/routes/app.rs Outdated Show resolved Hide resolved
crates/router/src/routes/app.rs Outdated Show resolved Hide resolved
crates/router/src/services/authentication.rs Outdated Show resolved Hide resolved
crates/router/src/services/authentication/detached.rs Outdated Show resolved Hide resolved
jarnura
jarnura previously approved these changes Jun 4, 2024
Copy link
Member

@jarnura jarnura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

crates/router/src/routes/app.rs Outdated Show resolved Hide resolved
crates/router/src/routes/app.rs Outdated Show resolved Hide resolved
crates/router/src/services/authentication/detached.rs Outdated Show resolved Hide resolved
@NishantJoshi00 NishantJoshi00 requested a review from a team as a code owner June 28, 2024 09:01
akshay-97
akshay-97 previously approved these changes Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-framework Area: Framework S-waiting-on-review Status: This PR has been implemented and needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Allow authentication to be done outside the router application
5 participants