aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2015-12-15 12:02:59 -0800
committerVitaly Buka <vitalybuka@google.com>2015-12-16 01:40:11 +0000
commit305ab613de85f6640f300010a17cb6ea22be2081 (patch)
tree17befb891acd88efc54b83927506e6a9b8faf8e1 /src
parent2d24e0ea050085e91bb8282a0408561d6a17797a (diff)
downloadlibweave-305ab613de85f6640f300010a17cb6ea22be2081.tar.gz
Rename ConfirmAuthToken -> ConfirmClientAuthToken
Change-Id: If7ecdb3cfd168a7054300fd229bd1e8dc534469a Reviewed-on: https://weave-review.googlesource.com/1965 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/device_registration_info.cc2
-rw-r--r--src/privet/auth_manager.cc4
-rw-r--r--src/privet/auth_manager.h3
-rw-r--r--src/privet/auth_manager_unittest.cc12
-rw-r--r--src/privet/mock_delegates.h4
-rw-r--r--src/privet/privet_handler.cc2
-rw-r--r--src/privet/security_delegate.h3
-rw-r--r--src/privet/security_manager.cc6
-rw-r--r--src/privet/security_manager.h3
9 files changed, 21 insertions, 18 deletions
diff --git a/src/device_registration_info.cc b/src/device_registration_info.cc
index 57e419c..47fa40c 100644
--- a/src/device_registration_info.cc
+++ b/src/device_registration_info.cc
@@ -969,7 +969,7 @@ void DeviceRegistrationInfo::OnSendAuthInfoDone(
CHECK(auth_info_update_inprogress_);
auth_info_update_inprogress_ = false;
- if (!error && auth_manager_->ConfirmAuthToken(token, nullptr))
+ if (!error && auth_manager_->ConfirmClientAuthToken(token, nullptr))
return;
task_runner_->PostDelayedTask(
diff --git a/src/privet/auth_manager.cc b/src/privet/auth_manager.cc
index f9f6777..62a640f 100644
--- a/src/privet/auth_manager.cc
+++ b/src/privet/auth_manager.cc
@@ -171,8 +171,8 @@ std::vector<uint8_t> AuthManager::ClaimRootClientAuthToken(
return pending_claims_.back().first->GetRootClientAuthToken();
}
-bool AuthManager::ConfirmAuthToken(const std::vector<uint8_t>& token,
- ErrorPtr* error) {
+bool AuthManager::ConfirmClientAuthToken(const std::vector<uint8_t>& token,
+ ErrorPtr* error) {
// Cover case when caller sent confirm twice.
if (pending_claims_.empty() && IsValidAuthToken(token))
return true;
diff --git a/src/privet/auth_manager.h b/src/privet/auth_manager.h
index ce406ce..44b8bca 100644
--- a/src/privet/auth_manager.h
+++ b/src/privet/auth_manager.h
@@ -46,7 +46,8 @@ class AuthManager {
std::vector<uint8_t> ClaimRootClientAuthToken(RootClientTokenOwner owner,
ErrorPtr* error);
- bool ConfirmAuthToken(const std::vector<uint8_t>& token, ErrorPtr* error);
+ bool ConfirmClientAuthToken(const std::vector<uint8_t>& token,
+ ErrorPtr* error);
std::vector<uint8_t> GetRootClientAuthToken() const;
bool IsValidAuthToken(const std::vector<uint8_t>& token) const;
diff --git a/src/privet/auth_manager_unittest.cc b/src/privet/auth_manager_unittest.cc
index aa124e1..91b0d4e 100644
--- a/src/privet/auth_manager_unittest.cc
+++ b/src/privet/auth_manager_unittest.cc
@@ -192,7 +192,7 @@ TEST_F(AuthManagerClaimTest, NormalClaim) {
EXPECT_EQ(RootClientTokenOwner::kNone,
config_.GetSettings().root_client_token_owner);
- EXPECT_TRUE(auth_.ConfirmAuthToken(token, nullptr));
+ EXPECT_TRUE(auth_.ConfirmClientAuthToken(token, nullptr));
EXPECT_TRUE(auth_.IsValidAuthToken(token));
EXPECT_EQ(RootClientTokenOwner::kCloud,
config_.GetSettings().root_client_token_owner);
@@ -201,8 +201,8 @@ TEST_F(AuthManagerClaimTest, NormalClaim) {
TEST_F(AuthManagerClaimTest, DoubleConfirm) {
auto token =
auth_.ClaimRootClientAuthToken(RootClientTokenOwner::kCloud, nullptr);
- EXPECT_TRUE(auth_.ConfirmAuthToken(token, nullptr));
- EXPECT_TRUE(auth_.ConfirmAuthToken(token, nullptr));
+ EXPECT_TRUE(auth_.ConfirmClientAuthToken(token, nullptr));
+ EXPECT_TRUE(auth_.ConfirmClientAuthToken(token, nullptr));
}
TEST_F(AuthManagerClaimTest, DoubleClaim) {
@@ -210,8 +210,8 @@ TEST_F(AuthManagerClaimTest, DoubleClaim) {
auth_.ClaimRootClientAuthToken(RootClientTokenOwner::kCloud, nullptr);
auto token2 =
auth_.ClaimRootClientAuthToken(RootClientTokenOwner::kCloud, nullptr);
- EXPECT_TRUE(auth_.ConfirmAuthToken(token1, nullptr));
- EXPECT_FALSE(auth_.ConfirmAuthToken(token2, nullptr));
+ EXPECT_TRUE(auth_.ConfirmClientAuthToken(token1, nullptr));
+ EXPECT_FALSE(auth_.ConfirmClientAuthToken(token2, nullptr));
}
TEST_F(AuthManagerClaimTest, TokenOverflow) {
@@ -219,7 +219,7 @@ TEST_F(AuthManagerClaimTest, TokenOverflow) {
auth_.ClaimRootClientAuthToken(RootClientTokenOwner::kCloud, nullptr);
for (size_t i = 0; i < 100; ++i)
auth_.ClaimRootClientAuthToken(RootClientTokenOwner::kCloud, nullptr);
- EXPECT_FALSE(auth_.ConfirmAuthToken(token, nullptr));
+ EXPECT_FALSE(auth_.ConfirmClientAuthToken(token, nullptr));
}
} // namespace privet
diff --git a/src/privet/mock_delegates.h b/src/privet/mock_delegates.h
index 9e647e3..de94fe9 100644
--- a/src/privet/mock_delegates.h
+++ b/src/privet/mock_delegates.h
@@ -68,7 +68,7 @@ class MockSecurityDelegate : public SecurityDelegate {
MOCK_CONST_METHOD0(GetPairingTypes, std::set<PairingType>());
MOCK_CONST_METHOD0(GetCryptoTypes, std::set<CryptoType>());
MOCK_METHOD1(ClaimRootClientAuthToken, std::string(ErrorPtr*));
- MOCK_METHOD2(ConfirmAuthToken, bool(const std::string&, ErrorPtr*));
+ MOCK_METHOD2(ConfirmClientAuthToken, bool(const std::string&, ErrorPtr*));
MOCK_CONST_METHOD1(IsValidPairingCode, bool(const std::string&));
MOCK_METHOD5(
StartPairing,
@@ -88,7 +88,7 @@ class MockSecurityDelegate : public SecurityDelegate {
EXPECT_CALL(*this, ClaimRootClientAuthToken(_))
.WillRepeatedly(Return("RootClientAuthToken"));
- EXPECT_CALL(*this, ConfirmAuthToken("DerivedClientAuthToken", _))
+ EXPECT_CALL(*this, ConfirmClientAuthToken("DerivedClientAuthToken", _))
.WillRepeatedly(Return(true));
EXPECT_CALL(*this, ParseAccessToken(_, _))
diff --git a/src/privet/privet_handler.cc b/src/privet/privet_handler.cc
index d1be61a..bfcc991 100644
--- a/src/privet/privet_handler.cc
+++ b/src/privet/privet_handler.cc
@@ -776,7 +776,7 @@ void PrivetHandler::HandleAccessControlConfirm(
return ReturnError(*error, callback);
}
- if (!security_->ConfirmAuthToken(token, &error))
+ if (!security_->ConfirmClientAuthToken(token, &error))
return ReturnError(*error, callback);
base::DictionaryValue output;
diff --git a/src/privet/security_delegate.h b/src/privet/security_delegate.h
index adc582d..54f957d 100644
--- a/src/privet/security_delegate.h
+++ b/src/privet/security_delegate.h
@@ -39,7 +39,8 @@ class SecurityDelegate {
// Confirms pending pending token claim or checks that token is valid for the
// active secret.
- virtual bool ConfirmAuthToken(const std::string& token, ErrorPtr* error) = 0;
+ virtual bool ConfirmClientAuthToken(const std::string& token,
+ ErrorPtr* error) = 0;
// Returns true if |auth_code| provided by client is valid. Client should
// obtain |auth_code| during pairing process.
diff --git a/src/privet/security_manager.cc b/src/privet/security_manager.cc
index 5bb35cc..d2025b1 100644
--- a/src/privet/security_manager.cc
+++ b/src/privet/security_manager.cc
@@ -140,8 +140,8 @@ std::string SecurityManager::ClaimRootClientAuthToken(ErrorPtr* error) {
RootClientTokenOwner::kClient, error));
}
-bool SecurityManager::ConfirmAuthToken(const std::string& token,
- ErrorPtr* error) {
+bool SecurityManager::ConfirmClientAuthToken(const std::string& token,
+ ErrorPtr* error) {
std::vector<uint8_t> token_decoded;
if (!Base64Decode(token, &token_decoded)) {
Error::AddToPrintf(error, FROM_HERE, errors::kDomain,
@@ -149,7 +149,7 @@ bool SecurityManager::ConfirmAuthToken(const std::string& token,
"Invalid auth token string: '%s'", token.c_str());
return false;
}
- return auth_manager_->ConfirmAuthToken(token_decoded, error);
+ return auth_manager_->ConfirmClientAuthToken(token_decoded, error);
}
bool SecurityManager::IsValidPairingCode(const std::string& auth_code) const {
diff --git a/src/privet/security_manager.h b/src/privet/security_manager.h
index 36dbbf4..93618d2 100644
--- a/src/privet/security_manager.h
+++ b/src/privet/security_manager.h
@@ -66,7 +66,8 @@ class SecurityManager : public SecurityDelegate {
std::set<PairingType> GetPairingTypes() const override;
std::set<CryptoType> GetCryptoTypes() const override;
std::string ClaimRootClientAuthToken(ErrorPtr* error) override;
- bool ConfirmAuthToken(const std::string& token, ErrorPtr* error) override;
+ bool ConfirmClientAuthToken(const std::string& token,
+ ErrorPtr* error) override;
bool IsValidPairingCode(const std::string& auth_code) const override;
bool StartPairing(PairingType mode,