Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

v2 API requires changes to authorization flow #41

Open
StraightfaceStudios opened this issue Jun 8, 2019 · 0 comments
Open

v2 API requires changes to authorization flow #41

StraightfaceStudios opened this issue Jun 8, 2019 · 0 comments

Comments

@StraightfaceStudios
Copy link

In regard to ../b2/response/B2AuthorizeAccountResponse.java:

In v2 of the API there can now be application key pairs that have permission to only ever read specific buckets.

"Most of the API calls that deal with buckets or files use a bucketId to identify a bucket. But, when using an application key that restricts access to just one bucket, you can't use b2_list_buckets to list all the buckets.

When there is a bucket restriction, the bucketId and the bucketName for that bucket are in the response from b2_authorize_account in the allowed section. You can then use that bucketId in all of your later calls."

https://www.backblaze.com/b2/docs/application_keys.html#usingRestrictedKeys

As a result there needs to be a new attribute in the b2client object that includes a list of "Allowed" buckets. The response from Backblaze now looks like this:

  "allowed": {
         "bucketId": "****",
         "bucketName": "AAABCC",

And add some sort of functionality like b2AuthorizeAccountResponse.getAllowedBuckets()

Similarly .../b2/request/B2ListBucketsRequest.java will need to be extended to avoid the error scenario where listing buckets results in a permission error even though the account can list specific buckets.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant