| 1 | /*++ |
| 2 | |
| 3 | Copyright (c) Microsoft. All rights reserved. |
| 4 | |
| 5 | Module Name: |
| 6 | |
| 7 | RegistryService.h |
| 8 | |
| 9 | Abstract: |
| 10 | |
| 11 | This file contains the RegistryService definition |
| 12 | |
| 13 | --*/ |
| 14 | #pragma once |
| 15 | |
| 16 | #include "ICredentialStorage.h" |
| 17 | #include "SessionModel.h" |
| 18 | |
| 19 | namespace wsl::windows::wslc::services { |
| 20 | |
| 21 | // High-level registry authentication service. |
| 22 | // Delegates credential persistence to ICredentialStorage (selected via OpenCredentialStorage). |
| 23 | class RegistryService |
| 24 | { |
| 25 | public: |
| 26 | static void Store(const std::string& serverAddress, const std::string& username, const std::string& secret); |
| 27 | static std::string Get(const std::string& serverAddress); |
| 28 | static void Erase(const std::string& serverAddress); |
| 29 | static std::vector<std::wstring> List(); |
| 30 | static std::pair<std::string, std::string> Authenticate( |
| 31 | wsl::windows::wslc::models::Session& session, const std::string& serverAddress, const std::string& username, const std::string& password); |
| 32 | |
| 33 | // Default registry server address used when no explicit server is provided. |
| 34 | static constexpr auto DefaultServer = "https://index.docker.io/v1/"; |
| 35 | }; |
| 36 | |
| 37 | } // namespace wsl::windows::wslc::services |