| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | ICredentialStorage.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | Interface for credential storage backends. |
| 12 | |
| 13 | --*/ |
| 14 | #pragma once |
| 15 | |
| 16 | #include <memory> |
| 17 | #include <string> |
| 18 | #include <vector> |
| 19 | |
| 20 | namespace wsl::windows::wslc::services { |
| 21 | |
| 22 | // Abstract interface for credential storage backends (WinCred, file-based, etc.). |
| 23 | struct ICredentialStorage |
| 24 | { |
| 25 | virtual ~ICredentialStorage() = default; |
| 26 | |
| 27 | virtual void Store(const std::string& serverAddress, const std::string& username, const std::string& secret) = 0; |
| 28 | virtual std::pair<std::string, std::string> Get(const std::string& serverAddress) = 0; |
| 29 | virtual void Erase(const std::string& serverAddress) = 0; |
| 30 | virtual std::vector<std::wstring> List() = 0; |
| 31 | }; |
| 32 | |
| 33 | // Returns the credential storage implementation based on user configuration. |
| 34 | std::unique_ptr<ICredentialStorage> OpenCredentialStorage(); |
| 35 | |
| 36 | } // namespace wsl::windows::wslc::services |