Fixed name of the function to match design docs. This is called there as Root Client Authorization Token (RCAT). Change-Id: I906a6d887506369d3deb028636e2b630ef325b81 Reviewed-on: https://weave-review.googlesource.com/1884 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/device_registration_info.cc b/src/device_registration_info.cc index a6d863c..68c5505 100644 --- a/src/device_registration_info.cc +++ b/src/device_registration_info.cc
@@ -936,7 +936,7 @@ auth_info_update_inprogress_ = true; std::string id = GetSettings().device_id; - std::string token = Base64Encode(auth_manager_->GetRootDeviceToken()); + std::string token = Base64Encode(auth_manager_->GetRootClientAuthToken()); std::string fingerprint = Base64Encode(auth_manager_->GetCertificateFingerprint());
diff --git a/src/privet/auth_manager.cc b/src/privet/auth_manager.cc index 49ef787..6a79b93 100644 --- a/src/privet/auth_manager.cc +++ b/src/privet/auth_manager.cc
@@ -108,7 +108,7 @@ return SplitTokenData(std::string(data.begin(), data.end()), time); } -std::vector<uint8_t> AuthManager::GetRootDeviceToken() const { +std::vector<uint8_t> AuthManager::GetRootClientAuthToken() const { Caveat scope{kUwMacaroonCaveatTypeScope, kUwMacaroonCaveatScopeTypeOwner}; Caveat issued{kUwMacaroonCaveatTypeIssued, static_cast<uint32_t>(Now().ToTimeT())};
diff --git a/src/privet/auth_manager.h b/src/privet/auth_manager.h index b3a9599..b893be3 100644 --- a/src/privet/auth_manager.h +++ b/src/privet/auth_manager.h
@@ -32,7 +32,7 @@ const std::vector<uint8_t>& GetCertificateFingerprint() const { return certificate_fingerprint_; } - std::vector<uint8_t> GetRootDeviceToken() const; + std::vector<uint8_t> GetRootClientAuthToken() const; base::Time Now() const;
diff --git a/src/privet/auth_manager_unittest.cc b/src/privet/auth_manager_unittest.cc index 4847e01..a7aa621 100644 --- a/src/privet/auth_manager_unittest.cc +++ b/src/privet/auth_manager_unittest.cc
@@ -115,22 +115,22 @@ } } -TEST_F(AuthManagerTest, GetRootDeviceToken) { +TEST_F(AuthManagerTest, GetRootClientAuthToken) { EXPECT_EQ("UFTBUcgd9d0HnPRnLeroN2mCQgECRgMaVArkgA==", - Base64Encode(auth_.GetRootDeviceToken())); + Base64Encode(auth_.GetRootClientAuthToken())); } -TEST_F(AuthManagerTest, GetRootDeviceTokenDifferentTime) { +TEST_F(AuthManagerTest, GetRootClientAuthTokenDifferentTime) { EXPECT_CALL(clock_, Now()) .WillRepeatedly(Return(clock_.Now() + base::TimeDelta::FromDays(15))); EXPECT_EQ("UGKqwMYGQNOd8jeYFDOsM02CQgECRgMaVB6rAA==", - Base64Encode(auth_.GetRootDeviceToken())); + Base64Encode(auth_.GetRootClientAuthToken())); } -TEST_F(AuthManagerTest, GetRootDeviceTokenDifferentSecret) { +TEST_F(AuthManagerTest, GetRootClientAuthTokenDifferentSecret) { AuthManager auth{kSecret2, {}, &clock_}; EXPECT_EQ("UK1ACOc3cWGjGBoTIX2bd3qCQgECRgMaVArkgA==", - Base64Encode(auth.GetRootDeviceToken())); + Base64Encode(auth.GetRootClientAuthToken())); } } // namespace privet