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

added root tokens and endpoint for adding api keys #742

Merged
merged 5 commits into from
Jan 15, 2023

Conversation

yk
Copy link
Collaborator

@yk yk commented Jan 15, 2023

  • added root tokens
  • added an admin api router for creating api clients
  • changed the dummy api key mechanism to only support the fixed key 1234

@yk yk linked an issue Jan 15, 2023 that may be closed by this pull request
@yk
Copy link
Collaborator Author

yk commented Jan 15, 2023

Note: I did not provide a server default for the root token entry in the api client table, thus, we'll have to wipe DBs upon merging

Copy link
Collaborator

@andreaskoepf andreaskoepf left a comment

Choose a reason for hiding this comment

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

ok, now we need to clarify how the create_api key endpoint is called, e.g. manually via /docs ui, by a pythin-script (cmdline tool) or a special mode of the frontend when an api-key is missing in the config.



def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe add op.execute("DELETE FROM api_client;")?

logger.info(f"ANY_API_KEY missing, inserting api_key: {DUMMY_API_KEY}")
api_client = create_api_client(
db=db,
added_by_root_token="1234",
Copy link
Collaborator

Choose a reason for hiding this comment

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

since the value is hardcoded here, we could use something else, e.g. 4711 or 0000 to distinguish it from api-keys created with a settings.ROOT_TOKENS value..

@yk
Copy link
Collaborator Author

yk commented Jan 15, 2023

  • I removed the tracked_by_root_token, we have no use for it currently
  • the endpoint is just for super-admins to create new api keys. we can call it via curl or /docs

@yk yk enabled auto-merge (squash) January 15, 2023 21:23
@yk yk merged commit cc03376 into main Jan 15, 2023
@yk yk deleted the 528-no-flow-to-create-api-keys branch January 15, 2023 21:24
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.

No flow to create API Keys
2 participants