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

v2 API requires changes to authorization flow #41

@StraightfaceStudios

Description

@StraightfaceStudios

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions