[#163] Support JSON bearer token #172

Open
r.loginov wants to merge 1 commit from r.loginov/frostfs-http-gw:feature/163-add_support_json_bearer_token into master
Member

close #163

Checking the work (with aio):

$ frostfs-cli container create -r localhost:8080 --wallet ./s3-gw/user-wallet.json --policy "REP 1"  --basic-acl 0 --await
Enter password > 
CID: AXjb22KLET3FjeJJxNJAUHUL4EEn92BFbV95d2Womj3q
awaiting...
container has been persisted on sidechain

$ frostfs-cli ape-manager add -r localhost:8080 --wallet ./s3-gw/user-wallet.json \
  --target-type container --target-name AXjb22KLET3FjeJJxNJAUHUL4EEn92BFbV95d2Womj3q \
  --rule "allow Object.* RequestCondition:"\$Actor:publicKey"=0324e76288fcb900100d01802a14ef977cca45ad073561230446df14b344c858b6 *" \
  --chain-id uniqChainID
Parsed chain:
Chain ID: uniqChainID
     HEX: 756e6971436861696e4944
Rules:

        Status: Allowed
        Any: false
        Conditions:
                Request $Actor:publicKey StringEquals 0324e76288fcb900100d01802a14ef977cca45ad073561230446df14b344c858b6
        Actions:        Inverted:false
                PutObject
                GetObject
                HeadObject
                DeleteObject
                SearchObject
                RangeObject
                HashObject
        Resources:      Inverted:false
                native:object/*
Enter password > 
Rule has been added.
Chain ID:  uniqChainID

$ frostfs-cli util sign bearer-token --json --from bearer.json --to signed.json -w ./s3-gw/user-wallet.json 
Enter password > 
signed bearer token was successfully dumped to signed.json

$ base64 -w 0 signed.json
eyJib2R5Ijp7ImVhY2xUYWJsZSI6bnVsbCwib3duZXJJRCI6bnVsbCwibGlmZXRpbWUiOnsiZXhwIjoiMTAwMDAiLCJuYmYiOiIwIiwiaWF0IjoiMCJ9LCJhbGxvd0ltcGVyc29uYXRlIjp0cnVlLCJhcGVPdmVycmlkZSI6bnVsbH0sInNpZ25hdHVyZSI6eyJrZXkiOiJBeVRuWW9qOHVRQVFEUUdBS2hUdmwzektSYTBITldFakJFYmZGTE5FeUZpMiIsInNpZ25hdHVyZSI6IkJNU0dKSXB4blFQMkJYT0RHWjVpejR2WC9ET3F6RlY3UWprZ2FROVNiWUpFYnJmODEwbUlGYVA4elhxODhlYkRJaHZUZWY1YzRBN0FuVkQ0TzVRWGNLYz0iLCJzY2hlbWUiOiJFQ0RTQV9TSEE1MTIifX0=

$  curl -F 'file=@Makefile;filename=makefile' -H "Authorization: Bearer eyJib2R5Ijp7ImVhY2xUYWJsZSI6bnVsbCwib3duZXJJRCI6bnVsbCwibGlmZXRpbWUiOnsiZXhwIjoiMTAwMDAiLCJuYmYiOiIwIiwiaWF0IjoiMCJ
9LCJhbGxvd0ltcGVyc29uYXRlIjp0cnVlLCJhcGVPdmVycmlkZSI6bnVsbH0sInNpZ25hdHVyZSI6eyJrZXkiOiJBeVRuWW9qOHVRQVFEUUdBS2hUdmwzektSYTBITldFakJFYmZGTE5FeUZpMiIsInNpZ25hdHVyZSI6IkJNU0dKSXB4blFQMkJYT0
RHWjVpejR2WC9ET3F6RlY3UWprZ2FROVNiWUpFYnJmODEwbUlGYVA4elhxODhlYkRJaHZUZWY1YzRBN0FuVkQ0TzVRWGNLYz0iLCJzY2hlbWUiOiJFQ0RTQV9TSEE1MTIifX0="   http://localhost:8881/upload/AXjb22KLET3FjeJJxNJA
UHUL4EEn92BFbV95d2Womj3q
{
        "object_id": "BmgCNztbLwPU428MCTydSm3msTmtGmmBwMAo5bm9eC6g",
        "container_id": "AXjb22KLET3FjeJJxNJAUHUL4EEn92BFbV95d2Womj3q"
}
close #163 Checking the work (with aio): ``` $ frostfs-cli container create -r localhost:8080 --wallet ./s3-gw/user-wallet.json --policy "REP 1" --basic-acl 0 --await Enter password > CID: AXjb22KLET3FjeJJxNJAUHUL4EEn92BFbV95d2Womj3q awaiting... container has been persisted on sidechain $ frostfs-cli ape-manager add -r localhost:8080 --wallet ./s3-gw/user-wallet.json \ --target-type container --target-name AXjb22KLET3FjeJJxNJAUHUL4EEn92BFbV95d2Womj3q \ --rule "allow Object.* RequestCondition:"\$Actor:publicKey"=0324e76288fcb900100d01802a14ef977cca45ad073561230446df14b344c858b6 *" \ --chain-id uniqChainID Parsed chain: Chain ID: uniqChainID HEX: 756e6971436861696e4944 Rules: Status: Allowed Any: false Conditions: Request $Actor:publicKey StringEquals 0324e76288fcb900100d01802a14ef977cca45ad073561230446df14b344c858b6 Actions: Inverted:false PutObject GetObject HeadObject DeleteObject SearchObject RangeObject HashObject Resources: Inverted:false native:object/* Enter password > Rule has been added. Chain ID: uniqChainID $ frostfs-cli util sign bearer-token --json --from bearer.json --to signed.json -w ./s3-gw/user-wallet.json Enter password > signed bearer token was successfully dumped to signed.json $ base64 -w 0 signed.json eyJib2R5Ijp7ImVhY2xUYWJsZSI6bnVsbCwib3duZXJJRCI6bnVsbCwibGlmZXRpbWUiOnsiZXhwIjoiMTAwMDAiLCJuYmYiOiIwIiwiaWF0IjoiMCJ9LCJhbGxvd0ltcGVyc29uYXRlIjp0cnVlLCJhcGVPdmVycmlkZSI6bnVsbH0sInNpZ25hdHVyZSI6eyJrZXkiOiJBeVRuWW9qOHVRQVFEUUdBS2hUdmwzektSYTBITldFakJFYmZGTE5FeUZpMiIsInNpZ25hdHVyZSI6IkJNU0dKSXB4blFQMkJYT0RHWjVpejR2WC9ET3F6RlY3UWprZ2FROVNiWUpFYnJmODEwbUlGYVA4elhxODhlYkRJaHZUZWY1YzRBN0FuVkQ0TzVRWGNLYz0iLCJzY2hlbWUiOiJFQ0RTQV9TSEE1MTIifX0= $ curl -F 'file=@Makefile;filename=makefile' -H "Authorization: Bearer eyJib2R5Ijp7ImVhY2xUYWJsZSI6bnVsbCwib3duZXJJRCI6bnVsbCwibGlmZXRpbWUiOnsiZXhwIjoiMTAwMDAiLCJuYmYiOiIwIiwiaWF0IjoiMCJ 9LCJhbGxvd0ltcGVyc29uYXRlIjp0cnVlLCJhcGVPdmVycmlkZSI6bnVsbH0sInNpZ25hdHVyZSI6eyJrZXkiOiJBeVRuWW9qOHVRQVFEUUdBS2hUdmwzektSYTBITldFakJFYmZGTE5FeUZpMiIsInNpZ25hdHVyZSI6IkJNU0dKSXB4blFQMkJYT0 RHWjVpejR2WC9ET3F6RlY3UWprZ2FROVNiWUpFYnJmODEwbUlGYVA4elhxODhlYkRJaHZUZWY1YzRBN0FuVkQ0TzVRWGNLYz0iLCJzY2hlbWUiOiJFQ0RTQV9TSEE1MTIifX0=" http://localhost:8881/upload/AXjb22KLET3FjeJJxNJA UHUL4EEn92BFbV95d2Womj3q { "object_id": "BmgCNztbLwPU428MCTydSm3msTmtGmmBwMAo5bm9eC6g", "container_id": "AXjb22KLET3FjeJJxNJAUHUL4EEn92BFbV95d2Womj3q" } ```
r.loginov self-assigned this 2024-11-29 06:56:51 +00:00
r.loginov added 1 commit 2024-11-29 06:56:51 +00:00
[#163] Support JSON bearer token
All checks were successful
/ DCO (pull_request) Successful in 1m43s
/ Vulncheck (pull_request) Successful in 2m0s
/ Builds (pull_request) Successful in 2m20s
/ Lint (pull_request) Successful in 3m25s
/ Tests (pull_request) Successful in 1m56s
4478d638ad
Signed-off-by: Roman Loginov <r.loginov@yadro.com>
r.loginov requested review from alexvanin 2024-11-29 06:56:51 +00:00
r.loginov requested review from dkirillov 2024-11-29 06:56:51 +00:00
r.loginov removed review request for alexvanin 2024-11-29 06:57:11 +00:00
r.loginov removed review request for dkirillov 2024-11-29 06:57:11 +00:00
r.loginov requested review from alexvanin 2024-11-29 07:08:32 +00:00
r.loginov requested review from dkirillov 2024-11-29 07:08:32 +00:00
r.loginov requested review from pogpp 2024-11-29 07:08:33 +00:00
r.loginov requested review from mbiryukova 2024-11-29 07:08:33 +00:00
r.loginov requested review from nzinkevich 2024-11-29 07:08:33 +00:00
dkirillov approved these changes 2024-11-29 08:11:37 +00:00
Dismissed
dkirillov left a comment
Member

LGTM, but can we add some integration test (see putWithBearerTokenInHeader in cmd/http-gw/integration_test.go)

LGTM, but can we add some integration test (see `putWithBearerTokenInHeader` in `cmd/http-gw/integration_test.go`)
r.loginov force-pushed feature/163-add_support_json_bearer_token from 4478d638ad to 58e7f3d583 2024-11-29 11:51:52 +00:00 Compare
r.loginov dismissed dkirillov's review 2024-11-29 11:51:52 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

mbiryukova approved these changes 2024-12-02 09:21:51 +00:00
Dismissed
dkirillov approved these changes 2024-12-02 13:33:19 +00:00
Dismissed
nzinkevich approved these changes 2024-12-04 12:36:54 +00:00
Dismissed
r.loginov force-pushed feature/163-add_support_json_bearer_token from 58e7f3d583 to 71fc6c85d5 2024-12-11 13:50:19 +00:00 Compare
r.loginov dismissed mbiryukova's review 2024-12-11 13:50:20 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

r.loginov dismissed dkirillov's review 2024-12-11 13:50:20 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

r.loginov dismissed nzinkevich's review 2024-12-11 13:50:20 +00:00
Reason:

New commits pushed, approval review dismissed automatically according to repository settings

alexvanin added this to the v0.33.0 milestone 2024-12-12 11:57:44 +00:00
r.loginov force-pushed feature/163-add_support_json_bearer_token from 71fc6c85d5 to 0b67375ceb 2024-12-13 11:42:27 +00:00 Compare
dkirillov approved these changes 2024-12-13 12:08:19 +00:00
All checks were successful
/ Vulncheck (pull_request) Successful in 2m38s
Required
Details
/ DCO (pull_request) Successful in 5m0s
Required
Details
/ Builds (pull_request) Successful in 2m57s
Required
Details
/ Lint (pull_request) Successful in 3m28s
Required
Details
/ Tests (pull_request) Successful in 2m46s
Required
Details
This pull request has changes conflicting with the target branch.
  • cmd/http-gw/integration_test.go
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u feature/163-add_support_json_bearer_token:r.loginov-feature/163-add_support_json_bearer_token
git checkout r.loginov-feature/163-add_support_json_bearer_token
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: TrueCloudLab/frostfs-http-gw#172
No description provided.