-
Notifications
You must be signed in to change notification settings - Fork 30
API gateway: api-keys in webserver, gateway services and client sdk #1460
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
Changes from 27 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
021a89c
Infra fixes
pcrespov 50f2687
Fixes make run-devel
pcrespov 29c4d35
api_version_prefix by api_vtag
pcrespov 3a80a36
Fixes start_db not called
pcrespov 6547e7a
Add helpers for fastapi
pcrespov e976ef5
Using new shortcuts
pcrespov 31cffe8
Fixes logging
pcrespov ef9aa0a
Doc and minor cleanup
pcrespov 59487c3
Bump version: 0.1.0 → 0.1.1
pcrespov 2684511
improves make info and formatting
pcrespov 85f9985
redoc: adds vender extensions
pcrespov 820e59e
Minor
pcrespov 36e14c3
Drafting client api sdk
pcrespov 606e3b8
Kills processes in 8001 upon make down
pcrespov 04ce0fc
Defining API entrypoints
pcrespov c8f3b2a
minimum tests pass
pcrespov 5f10ab5
fixes frontend linter
pcrespov 940b0fe
Minor
pcrespov d06526f
Cleanup front-end messages/labels
pcrespov c152577
Adds new table for client credentials api_keys
pcrespov c5b7c54
Added api-keys section on webserver API
pcrespov 2941e63
Minors
pcrespov 7385de9
Adding api-keys handlers
pcrespov 1b151e2
Tests for api-keys pass
pcrespov 57ae255
Minor fixes in API
pcrespov 3ca2655
webserver api version: 0.4.0 → 0.5.0
pcrespov 83b321e
updates codeowners
pcrespov 3b8a694
connects front-end by @odeimaiz (#27)
odeimaiz 656a1fe
Sets role-based access to allow only users to create tokens
pcrespov 32f2c77
Tests access to new entrypoints
pcrespov 1f819ef
Update responses
pcrespov d84d10e
webserver api version: 0.5.0 → 0.5.1
pcrespov 00e9bf6
Minor cleanup
pcrespov 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
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
37 changes: 37 additions & 0 deletions
37
...base/src/simcore_postgres_database/migration/versions/16ee7d73b9cc_adds_api_keys_table.py
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,37 @@ | ||
"""Adds api_keys table | ||
|
||
Revision ID: 16ee7d73b9cc | ||
Revises: f3555bb4bc34 | ||
Create Date: 2020-04-28 08:11:42.785688+00:00 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '16ee7d73b9cc' | ||
down_revision = 'f3555bb4bc34' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('api_keys', | ||
sa.Column('id', sa.BigInteger(), nullable=False), | ||
sa.Column('display_name', sa.String(), nullable=False), | ||
sa.Column('user_id', sa.BigInteger(), nullable=False), | ||
sa.Column('api_key', sa.String(), nullable=False), | ||
sa.Column('api_secret', sa.String(), nullable=False), | ||
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id'), | ||
sa.UniqueConstraint('display_name', 'user_id', name='display_name_userid_uniqueness') | ||
) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_table('api_keys') | ||
# ### end Alembic commands ### |
34 changes: 34 additions & 0 deletions
34
packages/postgres-database/src/simcore_postgres_database/models/api_keys.py
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,34 @@ | ||
""" API keys to access public gateway | ||
|
||
|
||
These keys grant the client authorization to the API resources | ||
|
||
+--------+ +---------------+ | ||
| |--(A)- Authorization Request ->| Resource | | ||
|client | | Owner | Authorization request | ||
| |<-(B)-- Authorization Grant ---| | | ||
+--------+ +---------------+ | ||
|
||
""" | ||
import sqlalchemy as sa | ||
|
||
from .base import metadata | ||
from .users import users | ||
|
||
api_keys = sa.Table( | ||
"api_keys", | ||
metadata, | ||
sa.Column("id", sa.BigInteger, nullable=False, primary_key=True), | ||
sa.Column("display_name", sa.String, nullable=False), | ||
sa.Column( | ||
"user_id", | ||
sa.BigInteger, | ||
sa.ForeignKey(users.c.id, ondelete="CASCADE"), | ||
pcrespov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
nullable=False, | ||
), | ||
sa.Column("api_key", sa.String, nullable=False), | ||
sa.Column("api_secret", sa.String, nullable=False), | ||
sa.UniqueConstraint( | ||
"display_name", "user_id", name="display_name_userid_uniqueness" | ||
), | ||
) |
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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
# | ||
# $ make devenv | ||
# | ||
pylint | ||
black | ||
pip-tools | ||
rope | ||
|
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,13 @@ | ||
# | ||
# Environment variables used to configure this service | ||
# | ||
|
||
# SEE services/api-gateway/src/simcore_service_api_gateway/auth_security.py | ||
SECRET_KEY=d0d0397de2c85ad26ffd4a0f9643dfe3a0ca3937f99cf3c2e174e11b5ef79880 | ||
|
||
# SEE services/api-gateway/src/simcore_service_api_gateway/settings.py | ||
LOGLEVEL=DEBUG | ||
|
||
POSTGRES_USER=test | ||
POSTGRES_PASSWORD=test | ||
POSTGRES_DB=test |
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 |
---|---|---|
@@ -1 +1 @@ | ||
0.1.0 | ||
0.1.1 |
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 |
---|---|---|
|
@@ -11,3 +11,6 @@ | |
|
||
# installs current package | ||
-e . | ||
|
||
# common dev-tools as well | ||
-r ../../../requirements.txt |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[bumpversion] | ||
current_version = 0.1.0 | ||
current_version = 0.1.1 | ||
commit = True | ||
tag = True | ||
|
||
|
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
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.