mirror of https://github.com/apache/jclouds.git
JCLOUDS-1519: Fix the authorization error with b2 application keys
This commit is contained in:
parent
2a773c2a72
commit
41d842d449
|
@ -50,9 +50,11 @@ public final class RequestAuthorization implements HttpRequestFilter {
|
|||
endpoint.getPath() +
|
||||
(endpoint.getQuery() == null ? "" : "?" + endpoint.getQuery()));
|
||||
|
||||
String updatedRequestBody = request.getPayload().getRawContent().toString().replaceAll("\"accountId\":.?\".*\"", "\"accountId\":\"" + auth.accountId() + "\"");
|
||||
request = request.toBuilder()
|
||||
.endpoint(endpoint)
|
||||
.replaceHeader(HttpHeaders.AUTHORIZATION, auth.authorizationToken())
|
||||
.payload(updatedRequestBody)
|
||||
.build();
|
||||
return request;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ final class B2TestUtils {
|
|||
* @see RecordedRequest
|
||||
*/
|
||||
private static void assertContentTypeIsJson(RecordedRequest request) {
|
||||
assertThat(request.getHeaders().values("Content-Type")).contains("application/json");
|
||||
assertThat(request.getHeaders().values("Content-Type")).contains("application/unknown");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"accountId": "ACCOUNT_ID",
|
||||
"accountId": "YOUR_ACCOUNT_ID",
|
||||
"bucketName": "any_name_you_pick",
|
||||
"bucketType": "allPrivate"
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"accountId": "ACCOUNT_ID",
|
||||
"accountId": "YOUR_ACCOUNT_ID",
|
||||
"bucketId": "4a48fe8875c6214145260818"
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"accountId": "ACCOUNT_ID"
|
||||
"accountId": "YOUR_ACCOUNT_ID"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"accountId": "ACCOUNT_ID",
|
||||
"accountId": "YOUR_ACCOUNT_ID",
|
||||
"bucketId": "4a48fe8875c6214145260818",
|
||||
"bucketType": "allPrivate"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue