-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #484 from atviriduomenys/122-auth-clients-self-ser…
…vice 122 Auth clients self service
- Loading branch information
Showing
20 changed files
with
1,718 additions
and
4,173 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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,71 @@ | ||
# notes/docker.sh Start docker compose | ||
# notes/postgres.sh Reset database | ||
|
||
INSTANCE=api/auth/clients | ||
DATASET=$INSTANCE | ||
# notes/spinta/server.sh Configure server | ||
|
||
cat > $BASEDIR/manifest.txt <<EOF | ||
d | r | b | m | property | type | access | ||
$DATASET | | | ||
| | | City | | | ||
| | | | name | string | open | ||
EOF | ||
poetry run spinta copy $BASEDIR/manifest.txt -o $BASEDIR/manifest.csv | ||
cat $BASEDIR/manifest.csv | ||
poetry run spinta show $BASEDIR/manifest.csv | ||
|
||
# notes/spinta/server.sh Run migrations | ||
# notes/spinta/server.sh Run server | ||
|
||
# notes/spinta/client.sh Configure client | ||
SERVER=:8000 | ||
CLIENT=test | ||
SECRET=secret | ||
SCOPES=( | ||
spinta_set_meta_fields | ||
spinta_getone | ||
spinta_getall | ||
spinta_search | ||
spinta_changes | ||
spinta_insert | ||
spinta_upsert | ||
spinta_update | ||
spinta_patch | ||
spinta_delete | ||
spinta_wipe | ||
spinta_auth_clients | ||
) | ||
http \ | ||
-a $CLIENT:$SECRET \ | ||
-f $SERVER/auth/token \ | ||
grant_type=client_credentials \ | ||
scope="$SCOPES" | ||
#| HTTP/1.1 400 Bad Request | ||
#| | ||
#| { | ||
#| "error": "invalid_scope", | ||
#| "error_description": "The requested scope is invalid, unknown, or malformed." | ||
#| } | ||
tail -50 $BASEDIR/spinta.log | ||
#| ERROR: Authorization server error: invalid_scope: | ||
#| Traceback (most recent call last): | ||
#| File "authlib/oauth2/rfc6749/authorization_server.py", line 185, in create_token_response | ||
#| grant.validate_token_request() | ||
#| File "authlib/oauth2/rfc6749/grants/client_credentials.py", line 72, in validate_token_request | ||
#| self.validate_requested_scope(client) | ||
#| File "authlib/oauth2/rfc6749/grants/base.py", line 92, in validate_requested_scope | ||
#| raise InvalidScopeError(state=self.request.state) | ||
#| authlib.oauth2.rfc6749.errors.InvalidScopeError: invalid_scope: | ||
#| INFO: "POST /auth/token HTTP/1.1" 400 Bad Request | ||
|
||
TOKEN=$( | ||
http \ | ||
-a $CLIENT:$SECRET \ | ||
-f $SERVER/auth/token \ | ||
grant_type=client_credentials \ | ||
scope="$SCOPES" \ | ||
| jq -r .access_token | ||
) | ||
AUTH="Authorization: Bearer $TOKEN" | ||
echo $AUTH |
This file contains 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 |
---|---|---|
|
@@ -77,6 +77,7 @@ spinta_update | |
spinta_patch | ||
spinta_delete | ||
spinta_wipe | ||
spinta_auth_clients | ||
EOF | ||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains 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 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.