LicenseSpring C++ SDK
Easily add Software Licensing to your application
LicenseManager.h
Go to the documentation of this file.
1 #ifndef LS_LICENSE_MANAGER_H
2 #define LS_LICENSE_MANAGER_H
3 
4 #ifdef _MSC_VER
5 #pragma once
6 #pragma warning( push )
7 #pragma warning( disable : 4251 )
8 #endif
9 
10 #include "BaseManager.h"
11 
12 namespace LicenseSpring
13 {
18  {
19  public:
20  using ptr_t = std::shared_ptr<LicenseManager>;
21 
27  static LicenseManager::ptr_t create( Configuration::ptr_t config, LicenseStorage::ptr_t storage = nullptr );
28 
31  LicenseManager( Configuration::ptr_t config, LicenseStorage::ptr_t storage = nullptr );
32 
34  ~LicenseManager() override;
35 
54  LicenseID getTrialLicense( Customer::ptr_t user = nullptr, const std::string& licensePolicy = std::string() );
55 
69  LicenseID getTrialLicense( const std::string& userEmail );
70 
83  std::string getSSOUrl( const std::string& accountCode = std::string(), bool useAuthCode = true );
84 
89  std::string getAirGapActivationCode( const std::string& initializationCode, const std::string& licenseKey );
90 
100  const License::ptr_t activateAirGapLicense( const std::string& confirmationCode, const std::wstring& policyPath, const std::string& licenseKey, uint32_t policyId );
101 
119  const License::ptr_t activateLicense( const LicenseID& licenseID );
120 
138  const License::ptr_t activateLicense( const LicenseID& licenseID,
139  const std::vector<DeviceVariable>& deviceVariables );
140 
161  const License::ptr_t activateLicense( const std::string& authData, const std::string& accountCode = std::string(),
162  bool useAuthCode = true );
163 
172  const License::ptr_t activateLicenseOffline( const std::wstring& activationResponseFile = std::wstring() );
173 
183  const License::ptr_t relinkLicense( DeviceIDAlgorithm deviceIdAlgorithm, const std::string& userPassword = "" );
184 
197  bool changePassword( const std::string& user, const std::string& password, const std::string& newPassword );
198 
211  std::vector<std::string> getVersionList( const LicenseID& licenseID,
212  const InstallFileFilter& filter = InstallFileFilter() );
213 
228  InstallationFile::ptr_t getInstallationFile( const LicenseID& licenseID,
229  const std::string& version = std::string(),
230  const InstallFileFilter& filter = InstallFileFilter() );
231 
237  std::wstring createOfflineActivationFile( const LicenseID& licenseID,
238  const std::wstring& activationRequestFile = std::wstring() );
239 
246  std::wstring createOfflineActivationFile( const LicenseID& licenseID,
247  const std::vector<DeviceVariable>& deviceVariables,
248  const std::wstring& activationRequestFile = std::wstring() );
249 
257  bool isOnline( bool throwExceptions = false ) const;
258 
270  std::vector<LicenseUser::ptr_t> getLicenseUsers( const Customer& customer );
271 
276  std::vector<LicenseUser::ptr_t> getLicenseUsers( const std::string& customerEmail );
277 
282  std::vector<UserLicensesData::ptr_t> getUserLicenses( const std::string& username, const std::string& password );
283 
284  };
285 }
286 
287 #ifdef _MSC_VER
288 #pragma warning( pop )
289 #endif
290 
291 #endif // LS_LICENSE_MANAGER_H
std::shared_ptr< Configuration > ptr_t
Definition: Configuration.h:20
std::shared_ptr< LicenseStorage > ptr_t
Base class for license management.
Definition: BaseManager.h:24
Class that encapsulates information about a customer.
Definition: Customer.h:17
std::shared_ptr< License > ptr_t
Definition: License.h:36
std::shared_ptr< LicenseManager > ptr_t
DeviceIDAlgorithm
Type of Device ID algorithm used by the SDK.
Definition: PODTypes.h:107
std::shared_ptr< Customer > ptr_t
Definition: Customer.h:20
#define LS_API
Macros that expands to dllexport, dllimport or nothing on non Windows platforms or in case of static ...
Definition: APIDef.h:22
Class that represents License identifier.
Definition: LicenseID.h:18
Class for performing basic requests to LicenseSpring backend and managing licenses.
std::shared_ptr< InstallationFile > ptr_t
Helper struct for filtering installation files by environment and channel.