Commit 2deed882 authored by Rakesh Soma's avatar Rakesh Soma Committed by Commit Bot

Support multi-value AD accounts custom attribute instead of single-value.

Bug: 1057855
Change-Id: I7a2ffbea114ffffefaaed2c011fb9de5fe7e1923
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2084032
Commit-Queue: Rakesh Soma <rakeshsoma@google.com>
Auto-Submit: Rakesh Soma <rakeshsoma@google.com>
Reviewed-by: default avatarYusuf Sengul <yusufsn@google.com>
Cr-Commit-Position: refs/heads/master@{#746201}
parent 34a43ffd
...@@ -179,9 +179,18 @@ HRESULT GetExistingAccountMappingFromCD( ...@@ -179,9 +179,18 @@ HRESULT GetExistingAccountMappingFromCD(
return hr; return hr;
} }
*sam_account_name = SearchForKeyInStringDictUTF8( std::vector<std::string> sam_account_names;
cd_user_response_json_string, hr = SearchForListInStringDictUTF8(
{kKeyCustomSchemas, kKeyEnhancedDesktopSecurity, kKeyADAccounts}); "value", cd_user_response_json_string,
{kKeyCustomSchemas, kKeyEnhancedDesktopSecurity, kKeyADAccounts},
&sam_account_names);
// Note: We only consider the first sam_account_name right now.
// We will expand this to consider all account names listed in the
// multi-value and perform username resolution in the future.
if (sam_account_names.size() > 0) {
*sam_account_name = sam_account_names.at(0);
}
hr = SearchForListInStringDictUTF8( hr = SearchForListInStringDictUTF8(
"value", cd_user_response_json_string, "value", cd_user_response_json_string,
......
...@@ -1440,7 +1440,7 @@ TEST_F(GcpGaiaCredentialBaseAdScenariosTest, ...@@ -1440,7 +1440,7 @@ TEST_F(GcpGaiaCredentialBaseAdScenariosTest,
// Invalid configuration in admin sdk. Don't set the username. // Invalid configuration in admin sdk. Don't set the username.
std::string admin_sdk_response = base::StringPrintf( std::string admin_sdk_response = base::StringPrintf(
"{\"customSchemas\": {\"Enhanced_desktop_security\": {\"AD_accounts\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": {\"AD_accounts\":"
" \"%ls\\\\\"}}}", "[{ \"value\": \"%ls\\\\\" }]}}}",
domain_name); domain_name);
fake_http_url_fetcher_factory()->SetFakeResponse( fake_http_url_fetcher_factory()->SetFakeResponse(
GURL(get_cd_user_url_.c_str()), FakeWinHttpUrlFetcher::Headers(), GURL(get_cd_user_url_.c_str()), FakeWinHttpUrlFetcher::Headers(),
...@@ -1495,7 +1495,7 @@ TEST_F(GcpGaiaCredentialBaseAdScenariosTest, ...@@ -1495,7 +1495,7 @@ TEST_F(GcpGaiaCredentialBaseAdScenariosTest,
// Set valid response from admin sdk. // Set valid response from admin sdk.
std::string admin_sdk_response = base::StringPrintf( std::string admin_sdk_response = base::StringPrintf(
"{\"customSchemas\": {\"Enhanced_desktop_security\": {\"AD_accounts\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": {\"AD_accounts\":"
" \"%ls\\\\%ls\"}}}", "[{ \"value\": \"%ls\\\\%ls\" }]}}}",
domain_name, user_name); domain_name, user_name);
fake_http_url_fetcher_factory()->SetFakeResponse( fake_http_url_fetcher_factory()->SetFakeResponse(
GURL(get_cd_user_url_.c_str()), FakeWinHttpUrlFetcher::Headers(), GURL(get_cd_user_url_.c_str()), FakeWinHttpUrlFetcher::Headers(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment