AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
LWAAuthorizationStorage.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 
16 #ifndef ACSDKAUTHORIZATION_LWA_LWAAUTHORIZATIONSTORAGE_H_
17 #define ACSDKAUTHORIZATION_LWA_LWAAUTHORIZATIONSTORAGE_H_
18 
19 #include <memory>
20 #include <string>
21 
29 
30 namespace alexaClientSDK {
31 namespace acsdkAuthorization {
32 namespace lwa {
33 
35 
45 public:
56  static std::shared_ptr<LWAAuthorizationStorageInterface> createStorage(
57  const std::shared_ptr<propertiesInterfaces::PropertiesFactoryInterface>& propertiesFactory);
58 
77  static std::shared_ptr<acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface>
79  const std::shared_ptr<avsCommon::utils::configuration::ConfigurationNode>& configurationRoot,
80  const std::string& storageRootKey,
81  const std::shared_ptr<cryptoInterfaces::CryptoFactoryInterface>& cryptoFactory,
82  const std::shared_ptr<cryptoInterfaces::KeyStoreInterface>& keyStore);
83 
88 
91  bool createDatabase() override;
92  bool open() override;
93  bool openOrCreate() override;
94  bool setRefreshToken(const std::string& refreshToken) override;
95  bool clearRefreshToken() override;
96  bool getRefreshToken(std::string* refreshToken) override;
97  bool setUserId(const std::string& userId) override;
98  bool getUserId(std::string* userId) override;
99  bool clear() override;
101 
102 private:
114  static std::shared_ptr<storage::sqliteStorage::SQLiteMiscStorage> createSQLiteStorage(
115  const std::shared_ptr<avsCommon::utils::configuration::ConfigurationNode>& configurationRoot,
116  const std::string& storageRootKey);
117 
130  static bool createStorageFileAndSetPermissions(const std::string& filepath) noexcept;
131 
136  const std::shared_ptr<alexaClientSDK::propertiesInterfaces::PropertiesFactoryInterface>& propertiesFactory);
137 
139  std::shared_ptr<alexaClientSDK::propertiesInterfaces::PropertiesFactoryInterface> m_propertiesFactory;
140 
142  std::shared_ptr<alexaClientSDK::propertiesInterfaces::PropertiesInterface> m_properties;
143 
146 };
147 
148 } // namespace lwa
149 } // namespace acsdkAuthorization
150 } // namespace alexaClientSDK
151 
152 #endif // ACSDKAUTHORIZATION_LWA_LWAAUTHORIZATIONSTORAGE_H_
::std::string string
Definition: gtest-port.h:1097
A SQLite based version of LWAAuthorizationStorageInterface.
Definition: LWAAuthorizationStorage.h:44
bool getRefreshToken(std::string *refreshToken) override
friend class LWAAuthorizationStorageTestHelper
Friend class for member access.
Definition: LWAAuthorizationStorage.h:145
bool setUserId(const std::string &userId) override
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
static std::shared_ptr< LWAAuthorizationStorageInterface > createStorage(const std::shared_ptr< propertiesInterfaces::PropertiesFactoryInterface > &propertiesFactory)
Create storage interface.
static std::shared_ptr< acsdkAuthorizationInterfaces::lwa::LWAAuthorizationStorageInterface > createLWAAuthorizationStorageInterface(const std::shared_ptr< avsCommon::utils::configuration::ConfigurationNode > &configurationRoot, const std::string &storageRootKey, const std::shared_ptr< cryptoInterfaces::CryptoFactoryInterface > &cryptoFactory, const std::shared_ptr< cryptoInterfaces::KeyStoreInterface > &keyStore)
Create storage interface backed by SQLite.
bool setRefreshToken(const std::string &refreshToken) override

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0