Skip to content

Conversation

@EmilienM
Copy link
Contributor

This commit introduces token-based authentication for the /prompt and
/rca-from-tempest API endpoints. Clients now need to include a
valid bearer token in the Authorization header to access these
resources.

Key changes include:

  • Added get_current_user dependency in src/api.py to validate
    tokens for protected routes.
  • Implemented the verify_token method in src/auth.py within the
    DatabaseAuthentification class to check token validity against the
    database and expiry.
  • Updated docs/api-quickstart.md to reflect the new authentication
    requirement, including Authorization header examples.

BREAKING CHANGE: Endpoints /prompt and /rca-from-tempest now
require authentication. Requests without a valid Authorization: Bearer <token>
header will be rejected with a 401 Unauthorized error.

Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

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

LGTM!:) 👍

I was able to successfully authenticate. The code rejects invalid tokens. I had to tweak the code a bit to check the authentication during testing because of the Jirka's work on the embedding model.

@EmilienM EmilienM force-pushed the auth_api branch 2 times, most recently from 9906636 to 127d2a6 Compare May 13, 2025 14:57
EmilienM added 2 commits May 13, 2025 16:18
This commit introduces token-based authentication for the `/prompt` and
`/rca-from-tempest` API endpoints. Clients now need to include a
valid bearer token in the `Authorization` header to access these
resources.

Key changes include:
- Added `get_current_user` dependency in `src/api.py` to validate
  tokens for protected routes.
- Implemented the `verify_token` method in `src/auth.py` within the
  `DatabaseAuthentification` class to check token validity against the
  database and expiry.
- Updated `docs/api-quickstart.md` to reflect the new authentication
  requirement, including `Authorization` header examples.

BREAKING CHANGE: Endpoints `/prompt` and `/rca-from-tempest` now
require authentication. Requests without a valid `Authorization: Bearer <token>`
header will be rejected with a 401 Unauthorized error.
@EmilienM EmilienM merged commit 63d1db4 into main May 15, 2025
3 checks passed
@EmilienM EmilienM deleted the auth_api branch May 15, 2025 01:56
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