Commit 14a6c6c5 authored by Rakesh Soma's avatar Rakesh Soma Committed by Commit Bot

Rename custom attribute naming based on latest UXW recommendation

Change-Id: Ic11c66281f2144d0e757eda3e5a5122b4322c222
Bug: 1052570
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057291
Auto-Submit: Rakesh Soma <rakeshsoma@google.com>
Reviewed-by: default avatarYusuf Sengul <yusufsn@google.com>
Reviewed-by: default avatarTien Mai <tienmai@chromium.org>
Commit-Queue: Rakesh Soma <rakeshsoma@google.com>
Cr-Commit-Position: refs/heads/master@{#741742}
parent 43ed2d03
...@@ -84,9 +84,9 @@ constexpr int kHttpTimeout = 3000; // in milliseconds ...@@ -84,9 +84,9 @@ constexpr int kHttpTimeout = 3000; // in milliseconds
// Names of keys used to fetch the custom attributes from google admin sdk // Names of keys used to fetch the custom attributes from google admin sdk
// users directory api. // users directory api.
constexpr char kKeyCustomSchemas[] = "customSchemas"; constexpr char kKeyCustomSchemas[] = "customSchemas";
constexpr char kKeyEmployeeData[] = "employeeData"; constexpr char kKeyEnhancedDesktopSecurity[] = "Enhanced_desktop_security";
constexpr char kKeySamAccountName[] = "samAccountName"; constexpr char kKeyADAccounts[] = "AD_accounts";
constexpr char kKeyLocalAccountInfo[] = "localAccountInfo"; constexpr char kKeyLocalWindowsAccounts[] = "Local_Windows_accounts";
base::string16 GetEmailDomains() { base::string16 GetEmailDomains() {
std::vector<wchar_t> email_domains(16); std::vector<wchar_t> email_domains(16);
...@@ -168,11 +168,12 @@ HRESULT GetExistingAccountMappingFromCD( ...@@ -168,11 +168,12 @@ HRESULT GetExistingAccountMappingFromCD(
*sam_account_name = SearchForKeyInStringDictUTF8( *sam_account_name = SearchForKeyInStringDictUTF8(
cd_user_response_json_string, cd_user_response_json_string,
{kKeyCustomSchemas, kKeyEmployeeData, kKeySamAccountName}); {kKeyCustomSchemas, kKeyEnhancedDesktopSecurity, kKeyADAccounts});
hr = SearchForListInStringDictUTF8( hr = SearchForListInStringDictUTF8(
"value", cd_user_response_json_string, "value", cd_user_response_json_string,
{kKeyCustomSchemas, kKeyEmployeeData, kKeyLocalAccountInfo}, {kKeyCustomSchemas, kKeyEnhancedDesktopSecurity,
kKeyLocalWindowsAccounts},
local_account_names); local_account_names);
if (FAILED(hr)) { if (FAILED(hr)) {
......
...@@ -1310,7 +1310,7 @@ TEST_P(GcpGaiaCredentialBaseCloudMappingTest, ...@@ -1310,7 +1310,7 @@ TEST_P(GcpGaiaCredentialBaseCloudMappingTest,
IDS_EMPTY_ACCESS_TOKEN_BASE)); IDS_EMPTY_ACCESS_TOKEN_BASE));
} }
// Empty samAccountName or localAccountInfo is returned via admin sdk. // Empty AD_accounts or Local_Windows_accounts is returned via admin sdk.
TEST_P(GcpGaiaCredentialBaseCloudMappingTest, TEST_P(GcpGaiaCredentialBaseCloudMappingTest,
GetSerialization_NoUserNameFoundFromAdminSdk) { GetSerialization_NoUserNameFoundFromAdminSdk) {
// Set token result a valid access token. // Set token result a valid access token.
...@@ -1340,7 +1340,7 @@ TEST_P(GcpGaiaCredentialBaseCloudMappingTest, ...@@ -1340,7 +1340,7 @@ TEST_P(GcpGaiaCredentialBaseCloudMappingTest,
EXPECT_EQ(2ul, fake_os_user_manager()->GetUserCount()); EXPECT_EQ(2ul, fake_os_user_manager()->GetUserCount());
} }
// Call to the admin sdk to fetch samAccountName or localAccountInfo failed. // Call to the admin sdk to fetch AD_accounts or Local_Windows_accounts failed.
TEST_P(GcpGaiaCredentialBaseCloudMappingTest, TEST_P(GcpGaiaCredentialBaseCloudMappingTest,
GetSerialization_CallToAdminSdkFailed) { GetSerialization_CallToAdminSdkFailed) {
// Set token result a valid access token. // Set token result a valid access token.
...@@ -1410,7 +1410,7 @@ void GcpGaiaCredentialBaseAdScenariosTest::SetUp() { ...@@ -1410,7 +1410,7 @@ void GcpGaiaCredentialBaseAdScenariosTest::SetUp() {
ASSERT_EQ(S_OK, InitializeProviderAndGetCredential(0, &cred_)); ASSERT_EQ(S_OK, InitializeProviderAndGetCredential(0, &cred_));
} }
// Customer configured invalid samAccountName. // Customer configured invalid AD_accounts.
TEST_F(GcpGaiaCredentialBaseAdScenariosTest, TEST_F(GcpGaiaCredentialBaseAdScenariosTest,
GetSerialization_WithAD_InvalidADUPNConfigured) { GetSerialization_WithAD_InvalidADUPNConfigured) {
// Add the user as a domain joined user. // Add the user as a domain joined user.
...@@ -1433,7 +1433,7 @@ TEST_F(GcpGaiaCredentialBaseAdScenariosTest, ...@@ -1433,7 +1433,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\": {\"employeeData\": {\"samAccountName\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": {\"AD_accounts\":"
" \"%ls/\"}}}", " \"%ls/\"}}}",
domain_name); domain_name);
fake_http_url_fetcher_factory()->SetFakeResponse( fake_http_url_fetcher_factory()->SetFakeResponse(
...@@ -1488,7 +1488,7 @@ TEST_F(GcpGaiaCredentialBaseAdScenariosTest, ...@@ -1488,7 +1488,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\": {\"employeeData\": {\"samAccountName\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": {\"AD_accounts\":"
" \"%ls/%ls\"}}}", " \"%ls/%ls\"}}}",
domain_name, user_name); domain_name, user_name);
fake_http_url_fetcher_factory()->SetFakeResponse( fake_http_url_fetcher_factory()->SetFakeResponse(
...@@ -1585,7 +1585,8 @@ TEST_F(GcpGaiaCredentialBaseCloudLocalAccountTest, ...@@ -1585,7 +1585,8 @@ TEST_F(GcpGaiaCredentialBaseCloudLocalAccountTest,
// 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\": {\"employeeData\": {\"localAccountInfo\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": "
"{\"Local_Windows_accounts\":"
" \"un:abcd\"}}}"); " \"un:abcd\"}}}");
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(),
...@@ -1632,11 +1633,12 @@ TEST_F(GcpGaiaCredentialBaseCloudLocalAccountTest, MultipleLocalAccountInfo) { ...@@ -1632,11 +1633,12 @@ TEST_F(GcpGaiaCredentialBaseCloudLocalAccountTest, MultipleLocalAccountInfo) {
const wchar_t another_user_name[] = L"another_local_user"; const wchar_t another_user_name[] = L"another_local_user";
// Set valid response from admin sdk with localAccountInfo containing // Set valid response from admin sdk with Local_Windows_accounts containing
// one mapping with "serial_number" in it and another one without // one mapping with "serial_number" in it and another one without
// serial number. // serial number.
admin_sdk_response = base::StringPrintf( admin_sdk_response = base::StringPrintf(
"{\"customSchemas\": {\"employeeData\": {\"localAccountInfo\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": "
"{\"Local_Windows_accounts\":"
"[{ \"value\": \"un:%ls,sn:%ls\" },{ \"value\": \"un:%ls\"}]}}}", "[{ \"value\": \"un:%ls,sn:%ls\" },{ \"value\": \"un:%ls\"}]}}}",
user_name, serial_number.c_str(), another_user_name); user_name, serial_number.c_str(), another_user_name);
fake_http_url_fetcher_factory()->SetFakeResponse( fake_http_url_fetcher_factory()->SetFakeResponse(
...@@ -1703,11 +1705,12 @@ TEST_F(GcpGaiaCredentialBaseCloudLocalAccountTest, ...@@ -1703,11 +1705,12 @@ TEST_F(GcpGaiaCredentialBaseCloudLocalAccountTest,
const wchar_t another_user_name1[] = L"another_local_user_1"; const wchar_t another_user_name1[] = L"another_local_user_1";
const wchar_t another_user_name2[] = L"another_local_user_2"; const wchar_t another_user_name2[] = L"another_local_user_2";
// Set valid response from admin sdk with localAccountInfo containing // Set valid response from admin sdk with Local_Windows_accounts containing
// multiple mappings with matching "serial_number" in it and another // multiple mappings with matching "serial_number" in it and another
// one without serial number. // one without serial number.
admin_sdk_response = base::StringPrintf( admin_sdk_response = base::StringPrintf(
"{\"customSchemas\": {\"employeeData\": {\"localAccountInfo\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": "
"{\"Local_Windows_accounts\":"
"[{ \"value\": \"un:%ls,sn:%ls\" },{ \"value\": \"un:%ls,sn:%ls\" },{ " "[{ \"value\": \"un:%ls,sn:%ls\" },{ \"value\": \"un:%ls,sn:%ls\" },{ "
" \"value\": \"un:%ls\" }]}}}", " \"value\": \"un:%ls\" }]}}}",
another_user_name1, serial_number.c_str(), another_user_name2, another_user_name1, serial_number.c_str(), another_user_name2,
...@@ -1765,11 +1768,12 @@ TEST_F(GcpGaiaCredentialBaseCloudLocalAccountTest, ...@@ -1765,11 +1768,12 @@ TEST_F(GcpGaiaCredentialBaseCloudLocalAccountTest,
const wchar_t another_user_name1[] = L"another_local_user_1"; const wchar_t another_user_name1[] = L"another_local_user_1";
const wchar_t another_user_name2[] = L"another_local_user_2"; const wchar_t another_user_name2[] = L"another_local_user_2";
// Set valid response from admin sdk with localAccountInfo containing // Set valid response from admin sdk with Local_Windows_accounts containing
// multiple mappings with matching "serial_number" in it and multiple // multiple mappings with matching "serial_number" in it and multiple
// mappings without serial number. // mappings without serial number.
admin_sdk_response = base::StringPrintf( admin_sdk_response = base::StringPrintf(
"{\"customSchemas\": {\"employeeData\": {\"localAccountInfo\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": "
"{\"Local_Windows_accounts\":"
"[{ \"value\": \"un:%ls,sn:%ls\" },{ \"value\": \"un:%ls,sn:%ls\" },{ " "[{ \"value\": \"un:%ls,sn:%ls\" },{ \"value\": \"un:%ls,sn:%ls\" },{ "
" \"value\": \"un:%ls\" },{ \"value\": \"un:%ls\"}]}}}", " \"value\": \"un:%ls\" },{ \"value\": \"un:%ls\"}]}}}",
another_user_name1, serial_number.c_str(), another_user_name2, another_user_name1, serial_number.c_str(), another_user_name2,
...@@ -1829,13 +1833,15 @@ TEST_P(GaiaCredentialBaseCloudLocalAccountSuccessTest, SerialNumber) { ...@@ -1829,13 +1833,15 @@ TEST_P(GaiaCredentialBaseCloudLocalAccountSuccessTest, SerialNumber) {
if (set_serial_number) { if (set_serial_number) {
// Set valid response from admin sdk. // Set valid response from admin sdk.
admin_sdk_response = base::StringPrintf( admin_sdk_response = base::StringPrintf(
"{\"customSchemas\": {\"employeeData\": {\"localAccountInfo\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": "
"{\"Local_Windows_accounts\":"
"[{ \"value\": \"un:%ls,sn:%ls\"}]}}}", "[{ \"value\": \"un:%ls,sn:%ls\"}]}}}",
user_name, serial_number.c_str()); user_name, serial_number.c_str());
} else { } else {
// Set valid response from admin sdk. // Set valid response from admin sdk.
admin_sdk_response = base::StringPrintf( admin_sdk_response = base::StringPrintf(
"{\"customSchemas\": {\"employeeData\": {\"localAccountInfo\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": "
"{\"Local_Windows_accounts\":"
"[{ \"value\": \"un:%ls\"}]}}}", "[{ \"value\": \"un:%ls\"}]}}}",
user_name); user_name);
} }
...@@ -1906,7 +1912,8 @@ TEST_P(GaiaCredentialBaseCDUsernameSuccessTest, AnyUsername) { ...@@ -1906,7 +1912,8 @@ TEST_P(GaiaCredentialBaseCDUsernameSuccessTest, AnyUsername) {
// 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\": {\"employeeData\": {\"localAccountInfo\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": "
"{\"Local_Windows_accounts\":"
"[{ \"value\": \"un:%ls\"}]}}}", "[{ \"value\": \"un:%ls\"}]}}}",
user_name); user_name);
...@@ -1971,7 +1978,8 @@ TEST_P(GaiaCredentialBaseCDSerialNumberFailureTest, InvalidSerialNumber) { ...@@ -1971,7 +1978,8 @@ TEST_P(GaiaCredentialBaseCDSerialNumberFailureTest, InvalidSerialNumber) {
// 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\": {\"employeeData\": {\"localAccountInfo\":" "{\"customSchemas\": {\"Enhanced_desktop_security\": "
"{\"Local_Windows_accounts\":"
"[{ \"value\": \"un:%ls,sn:%ls\"}]}}}", "[{ \"value\": \"un:%ls,sn:%ls\"}]}}}",
user_name, serial_number); user_name, serial_number);
......
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