This is an automated email from the ASF dual-hosted git repository. nickva pushed a commit to branch 3.5.x in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit d8a7374cef693376d6501777be3f3bbdfe052ffa Author: Robert Newson <[email protected]> AuthorDate: Wed Sep 30 11:38:42 2026 +0100 Match IBM's existing IAM auth plugin more closely. This makes it match the IBM plugin, just nested under the "ibm" vendor object. This will make it easier to configure Cloudant and CouchDB systems. (cherry picked from commit c42840d6c9716ca1820c1dc5e07a0d3d8d086910) --- .../src/couch_replicator_auth_ibm.erl | 19 ++++++++++++++----- src/docs/src/replication/replicator.rst | 6 ++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/couch_replicator/src/couch_replicator_auth_ibm.erl b/src/couch_replicator/src/couch_replicator_auth_ibm.erl index ed17080a0..1c8480a65 100644 --- a/src/couch_replicator/src/couch_replicator_auth_ibm.erl +++ b/src/couch_replicator/src/couch_replicator_auth_ibm.erl @@ -391,9 +391,14 @@ now_secs() -> extract_api_key(#httpdb{auth_props = AuthProps}) -> case proplists:get_value(~"ibm", AuthProps) of {IBMProps} when is_list(IBMProps) -> - case proplists:get_value(~"apikey", IBMProps) of - APIKey when is_binary(APIKey), byte_size(APIKey) > 0 -> - {ok, APIKey}; + case proplists:get_value(~"iam", IBMProps) of + {IAMProps} when is_list(IAMProps) -> + case proplists:get_value(~"api_key", IAMProps) of + APIKey when is_binary(APIKey), byte_size(APIKey) > 0 -> + {ok, APIKey}; + _ -> + {error, missing_api_key} + end; _ -> {error, missing_api_key} end; @@ -541,7 +546,9 @@ retry_ms() -> extract_api_key_test() -> ?assertEqual( {ok, ~"fake_api_key"}, - extract_api_key(#httpdb{auth_props = [{~"ibm", {[{~"apikey", ~"fake_api_key"}]}}]}) + extract_api_key(#httpdb{ + auth_props = [{~"ibm", {[{~"iam", {[{~"api_key", ~"fake_api_key"}]}}]}}] + }) ), ?assertEqual({error, missing_api_key}, extract_api_key(#httpdb{auth_props = []})). @@ -594,7 +601,9 @@ test_get_token(_) -> test_initialize(_) -> ?_test( begin - HttpDb = #httpdb{auth_props = [{~"ibm", {[{~"apikey", ~"fake_api_key"}]}}]}, + HttpDb = #httpdb{ + auth_props = [{~"ibm", {[{~"iam", {[{~"api_key", ~"fake_api_key"}]}}]}}] + }, Result2 = initialize(HttpDb), ?assertMatch( {ok, HttpDb, #worker_state{api_key_mac = MAC}} when is_binary(MAC), Result2 diff --git a/src/docs/src/replication/replicator.rst b/src/docs/src/replication/replicator.rst index 92a74f612..e3ae9e2ce 100644 --- a/src/docs/src/replication/replicator.rst +++ b/src/docs/src/replication/replicator.rst @@ -823,8 +823,10 @@ your source or target as follows; "url": "http://someurl.com/mydb", "auth": { "ibm": { - "apikey": "$apikey" - } + "iam": { + "api_key": "$apikey" + } + } } }, ...
