Extract privet::AuthManager from privet::SecurityManager
BUG:25934385
Change-Id: I45fb7c79053a6009330b4debae1065266d1ce972
Reviewed-on: https://weave-review.googlesource.com/1735
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/privet/auth_manager.h b/src/privet/auth_manager.h
new file mode 100644
index 0000000..607b820
--- /dev/null
+++ b/src/privet/auth_manager.h
@@ -0,0 +1,45 @@
+// Copyright 2015 The Weave Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef LIBWEAVE_SRC_PRIVET_AUTH_MANAGER_H_
+#define LIBWEAVE_SRC_PRIVET_AUTH_MANAGER_H_
+
+#include <string>
+#include <vector>
+
+#include <base/time/time.h>
+#include <weave/error.h>
+
+#include "src/privet/privet_types.h"
+
+namespace weave {
+namespace privet {
+
+class AuthManager {
+ public:
+ AuthManager(const std::vector<uint8_t>& secret,
+ const std::vector<uint8_t>& certificate_fingerprint);
+ ~AuthManager();
+
+ std::vector<uint8_t> CreateAccessToken(const UserInfo& user_info,
+ const base::Time& time);
+ UserInfo ParseAccessToken(const std::vector<uint8_t>& token,
+ base::Time* time) const;
+
+ const std::vector<uint8_t>& GetSecret() const { return secret_; }
+ const std::vector<uint8_t>& GetCertificateFingerprint() const {
+ return certificate_fingerprint_;
+ }
+
+ private:
+ std::vector<uint8_t> secret_;
+ std::vector<uint8_t> certificate_fingerprint_;
+
+ DISALLOW_COPY_AND_ASSIGN(AuthManager);
+};
+
+} // namespace privet
+} // namespace weave
+
+#endif // LIBWEAVE_SRC_PRIVET_AUTH_MANAGER_H_