-
Notifications
You must be signed in to change notification settings - Fork 3
Add authentication #97
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
Closed
Closed
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e76a5ca
Add authentication (#96)
bio-boris 6f6d083
Delete .github/workflows/docker-image.yml
bio-boris 56e6b23
Refactor wait_for_service tests for auth token handling
bio-boris 780158a
Fix tests
4cc54ef
remove comments
576c841
fix flake
93b7b68
Tests
5e81d49
Revise docstring for Elasticsearch auth tests
bio-boris 9c389aa
update creds
5934134
update creds
19ae693
update creds
688ace6
Tests
2883d61
Remove token
ec06906
Update query.py
bio-boris d8e7cbc
Update config.py
bio-boris 0863e36
Remove unused logging setup in config.py
bio-boris fd3b2d5
Remove comment on Elasticsearch auth header calculation
bio-boris da56683
Update Elasticsearch headers to use config for auth
bio-boris ac4c349
Update Elasticsearch auth token retrieval method
bio-boris 25230ee
Clean up imports in __main__.py
bio-boris 1971432
Update auth header retrieval in show_indexes
bio-boris 8b0a047
Update Elasticsearch auth header handling
bio-boris 01050de
Update timeouts
02bb1da
update tests
755060d
update tests
1bbc2d4
update tests
13a1d6e
Update timeouts
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| """ | ||
| Integration tests for Elasticsearch authentication. | ||
|
|
||
| These tests verify that the search API can successfully connect to and query | ||
| an Elasticsearch instance with authentication enabled (using the docker-compose setup). | ||
| """ | ||
| import requests | ||
| from src.utils.config import config | ||
|
|
||
|
|
||
| def test_elasticsearch_requires_auth(services): | ||
| """Test that Elasticsearch requires authentication (rejects requests without auth).""" | ||
| es_url = config['elasticsearch_url'] | ||
| resp_no_auth = requests.get(es_url) | ||
| assert resp_no_auth.status_code == 401, \ | ||
| f"Elasticsearch should require authentication, got status {resp_no_auth.status_code}" | ||
|
|
||
|
|
||
| def test_elasticsearch_with_auth(services): | ||
| """Test that Elasticsearch accepts requests with proper authentication.""" | ||
| es_url = config['elasticsearch_url'] | ||
| headers = {} | ||
| auth_header_value = config['authorization_header_value'] | ||
| if auth_header_value: | ||
| headers['Authorization'] = auth_header_value | ||
| resp_with_auth = requests.get(es_url, headers=headers) | ||
| assert resp_with_auth.status_code == 200, \ | ||
| f"Elasticsearch should accept authenticated requests, got status {resp_with_auth.status_code}" |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.