Skip to content

fix: add Authorization Bearer #2062

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
merged 3 commits into from
Mar 6, 2025
Merged

fix: add Authorization Bearer #2062

merged 3 commits into from
Mar 6, 2025

Conversation

vansangpfiev
Copy link
Contributor

@vansangpfiev vansangpfiev commented Mar 5, 2025

Describe Your Changes

This pull request introduces a new feature to support API key authentication and includes several changes across multiple files to implement this functionality. The most important changes include adding the api_keys field, updating the configuration handling, and integrating API key validation into the server.

API Key Authentication:

Configuration Handling:

Server Integration:

  • engine/main.cc: Implemented API key validation logic and registered it as a pre-routing advice in the server setup.

Fixes Issues

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

@vansangpfiev vansangpfiev changed the title fix: add simple authentication fix: add a simple authentication Mar 5, 2025
@vansangpfiev
Copy link
Contributor Author

Still in progress PR, @ramonpzg @qnixsynapse please help add your thoughts on how we can provide API authentication

@vansangpfiev
Copy link
Contributor Author

As I understand, if an application is attaching the credentials via an Authorization header then the browser cannot automatically authenticate the requests, and CSRF is not possible.

@vansangpfiev vansangpfiev changed the title fix: add a simple authentication fix: add a basic authentication Mar 6, 2025
@vansangpfiev vansangpfiev changed the title fix: add a basic authentication fix: add Bearer Authentication Mar 6, 2025
@vansangpfiev vansangpfiev marked this pull request as ready for review March 6, 2025 04:31
@vansangpfiev vansangpfiev changed the title fix: add Bearer Authentication fix: add Authorization Bearer Mar 6, 2025
Copy link
Contributor

@qnixsynapse qnixsynapse left a comment

Choose a reason for hiding this comment

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

So far looks good to me now.

@vansangpfiev vansangpfiev merged commit 14bc466 into dev Mar 6, 2025
16 checks passed
@vansangpfiev vansangpfiev deleted the s/fix/authentication branch March 6, 2025 05:31
vansangpfiev added a commit that referenced this pull request Mar 7, 2025
* fix: add simple authentication

* fix: exclude v1/configs

---------

Co-authored-by: sangjanai <sang@jan.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants