Skip to content

API key server logic #633

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
wants to merge 58 commits into from
Closed

API key server logic #633

wants to merge 58 commits into from

Conversation

sgratzl
Copy link
Member

@sgratzl sgratzl commented Jul 13, 2021

Prerequisites:

  • Unless it is a documentation hotfix it should be merged against the dev branch
  • Branch is up-to-date with the branch to be merged with, i.e. dev
  • Build is successful
  • Code is cleaned up and formatted

Summary

implements the server logic to require API keys and roles for the endpoints.

tasks

  • check for api key
  • show a soft warning
  • show a hard warning
  • adapt tests
  • create tests
  • admin interface?
  • [?] log / track api_key + query if allowed
  • create basic google form
  • connect google form with api server handling -> webhook
  • create a basic request a key form: /admin/create_key
  • use flask-limited for rate limiting
  • setup a Redis DB for shared rate limit tracking
  • define a good default rate limit
  • consider using Redis DB also for account management instead of SQL server

@sgratzl
Copy link
Member Author

sgratzl commented Jul 20, 2021

basic admin interface:

image

/admin/

@sgratzl
Copy link
Member Author

sgratzl commented Aug 13, 2021

[ ] setup a Redix DB for shared rate limit tracking

@korlaxxalrok heads up we are going to need some kind of redis like database that is accessible from all web server nodes

@sgratzl sgratzl self-assigned this Aug 13, 2021
@sgratzl sgratzl added api change affect the API and its responses enhancement labels Aug 13, 2021
@korlaxxalrok
Copy link
Contributor

@sgratzl What URL will we expose the admin interface at?

@sgratzl
Copy link
Member Author

sgratzl commented Aug 19, 2021

@sgratzl What URL will we expose the admin interface at?

so far the plan is on delphi.cmu.edu/epidata/admin/ which is connected to the master database. Thus, when you edit users it should get replicated to the other databases.

@korlaxxalrok
Copy link
Contributor

@sgratzl Re Redix DB. Can we use Redis?

@sgratzl
Copy link
Member Author

sgratzl commented Aug 23, 2021

@sgratzl Re Redix DB. Can we use Redis?

lol. I should watch out more for typos. Sure, it should be a Redis-compatible database. see also https://limits.readthedocs.io/en/latest/storage.html#storage-scheme

@krivard
Copy link
Contributor

krivard commented Feb 2, 2023

superceded by #1061

@krivard krivard closed this Feb 2, 2023
@krivard krivard deleted the sgratzl/api_key branch February 2, 2023 20:53
@melange396 melange396 restored the sgratzl/api_key branch March 29, 2023 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api change affect the API and its responses enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants