Provide RootClientTokenOwner into ClaimRootClientAuthToken
ClaimRootClientAuthToken will check if token is already claimed and
block claim if needed.
BUG=25766815
Change-Id: I8d12578c99307830afccd280c322d2240234e435
Reviewed-on: https://weave-review.googlesource.com/1934
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/privet/auth_manager.h b/src/privet/auth_manager.h
index dd4ad3d..62a1606 100644
--- a/src/privet/auth_manager.h
+++ b/src/privet/auth_manager.h
@@ -18,6 +18,7 @@
namespace weave {
class Config;
+enum class RootClientTokenOwner;
namespace privet {
@@ -43,14 +44,15 @@
base::Time Now() const;
- std::vector<uint8_t> ClaimRootClientAuthToken();
+ std::vector<uint8_t> ClaimRootClientAuthToken(RootClientTokenOwner owner);
bool ConfirmAuthToken(const std::vector<uint8_t>& token);
std::vector<uint8_t> GetRootClientAuthToken() const;
bool IsValidAuthToken(const std::vector<uint8_t>& token) const;
private:
- void SetSecret(const std::vector<uint8_t>& secret);
+ void SetSecret(const std::vector<uint8_t>& secret,
+ RootClientTokenOwner owner);
Config* config_{nullptr};
base::DefaultClock default_clock_;
@@ -59,7 +61,8 @@
std::vector<uint8_t> secret_;
std::vector<uint8_t> certificate_fingerprint_;
- std::deque<std::unique_ptr<AuthManager>> pending_claims_;
+ std::deque<std::pair<std::unique_ptr<AuthManager>, RootClientTokenOwner>>
+ pending_claims_;
DISALLOW_COPY_AND_ASSIGN(AuthManager);
};