Microsoft Information Protection (MIP) SDK for C++: Reference 1.16
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
protection_engine.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files(the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions :
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
27/**
28 * @brief Defines ProtectionEngine interface
29 *
30 * @file protection_engine.h
31 */
32
33#ifndef API_MIP_PROTECTION_PROTECTION_ENGINE_H_
34#define API_MIP_PROTECTION_PROTECTION_ENGINE_H_
35
36#include <chrono>
37#include <climits>
38#include <memory>
39#include <string>
40#include <vector>
41
42#include "mip/common_types.h"
43#include "mip/error.h"
44#include "mip/mip_export.h"
45#include "mip/mip_namespace.h"
56
57/** @cond DOXYGEN_HIDE */
58
59namespace {
60
61const int kMinTemplateBatchNum = 1; // 1 template per request (many operations in parallel, small packets)
62const int kMaxTemplateBatchNum = 25; // 25 templates per request (fewer operations in parallel, larger packets)
63
64} //namespace
65
66/** @endcond */
67
68
69MIP_NAMESPACE_BEGIN
70
71/**
72 * @brief Manages protection-related actions related to a specific identity
73 */
75public:
76 /**
77 * @brief Interface that receives notifications related to ProtectionEngine
78 *
79 * @note This interface must be implemented by applications using the protection SDK
80 */
81 class Observer {
82 public:
83 /**
84 * @brief Called when templates were retrieved successfully
85 *
86 * @param templateDescriptors A reference to the list of templates descriptors
87 * @param context The same context that was passed to ProtectionEngine::GetTemplatesAsync
88 *
89 * @note An application can pass any type of context (for example, std::promise, std::function) to
90 * ProtectionEngine::GetTemplatesAsync and that same context will be forwarded as-is to
91 * ProtectionEngine::Observer::OnGetTemplatesSuccess or ProtectionEngine::Observer::OnGetTemplatesFailure
92 */
94 const std::vector<std::shared_ptr<TemplateDescriptor>>& templateDescriptors,
95 const std::shared_ptr<void>& context) { UNUSED(templateDescriptors); UNUSED(context); }
96
97 /**
98 * @brief Called when retrieving templates generated an error
99 *
100 * @param error Error that occurred while retrieving templates
101 * @param context The same context that was passed to ProtectionEngine::GetTemplatesAsync
102 *
103 * @note An application can pass any type of context (for example, std::promise, std::function) to
104 * ProtectionEngine::GetTemplatesAsync and that same context will be forwarded as-is to
105 * ProtectionEngine::Observer::OnGetTemplatesSuccess or ProtectionEngine::Observer::OnGetTemplatesFailure
106 */
108 const std::exception_ptr& error,
109 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
110
111 /**
112 * @brief Called when rights were retrieved successfully
113 *
114 * @param rights A reference to the list of rights retrieved
115 * @param context The same context that was passed to ProtectionEngine::GetRightsForLabelIdAsync
116 *
117 * @note An application can pass any type of context (for example, std::promise, std::function) to
118 * ProtectionEngine::GetRightsForLabelIdAsync and that same context will be forwarded as-is to
119 * ProtectionEngine::Observer::OnGetRightsForLabelIdSuccess or ProtectionEngine::Observer::OnGetRightsForLabelIdFailure
120 */
122 const std::shared_ptr<std::vector<std::string>>& rights,
123 const std::shared_ptr<void>& context) { UNUSED(rights); UNUSED(context); }
124
125 /**
126 * @brief Called when retrieving rights for a label ID for the user
127 *
128 * @param error Error that occurred while retrieving rights
129 * @param context The same context that was passed to ProtectionEngine::GetRightsForLabelIdAsync
130 *
131 * @note An application can pass any type of context (for example, std::promise, std::function) to
132 * ProtectionEngine::GetRightsForLabelIdAsync and that same context will be forwarded as-is to
133 * ProtectionEngine::Observer::OnGetRightsForLabelIdSuccess or ProtectionEngine::Observer::OnGetRightsForLabelIdFailure
134 */
136 const std::exception_ptr& error,
137 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
138
139 /**
140 * @brief Called when user cert loaded successfully
141 *
142 * @param context The same context that was passed to ProtectionEngine::LoadUserCertAsync
143 *
144 * @note An application can pass any type of context (for example, std::promise, std::function) to
145 * ProtectionEngine::LoadUserCertAsync and that same context will be forwarded as-is to
146 * ProtectionEngine::Observer::OnLoadUserCertSuccess or ProtectionEngine::Observer::OnLoadUserCertFailure
147 */
149 const std::shared_ptr<void>& context) { UNUSED(context); }
150
151 /**
152 * @brief Called when user cert loaded failed
153 *
154 * @param error Error that occurred while retrieving rights
155 * @param context The same context that was passed to ProtectionEngine::LoadUserCertAsync
156 *
157 * @note An application can pass any type of context (for example, std::promise, std::function) to
158 * ProtectionEngine::LoadUserCertAsync and that same context will be forwarded as-is to
159 * ProtectionEngine::Observer::OnLoadUserCertSuccess or ProtectionEngine::Observer::OnLoadUserCertFailure
160 */
162 const std::exception_ptr& error,
163 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
164
165 /**
166 * @brief Called when registration of content for tracking & revocation is successful
167 *
168 * @param context The same context that was passed to ProtectionEngine::RegisterContentForTrackingAndRevocationAsync
169 *
170 * @note An application can pass any type of context (for example, std::promise, std::function) to
171 * ProtectionEngine::RegisterContentForTrackingAndRevocationAsync and that same context will be forwarded as-is to
172 * ProtectionEngine::Observer::OnRegisterContentForTrackingAndRevocationSuccess or ProtectionEngine::Observer::OnRegisterContentForTrackingAndRevocationFailure
173 */
175 const std::shared_ptr<void>& context) { UNUSED(context); }
176
177 /**
178 * @brief Called when registration of content for tracking & revocation fails
179 *
180 * @param error Error that occurred while registering content
181 * @param context The same context that was passed to ProtectionEngine::RegisterContentForTrackingAndRevocationAsync
182 *
183 * @note An application can pass any type of context (for example, std::promise, std::function) to
184 * ProtectionEngine::RegisterContentForTrackingAndRevocationAsync and that same context will be forwarded as-is to
185 * ProtectionEngine::Observer::OnRegisterContentForTrackingAndRevocationSuccess or ProtectionEngine::Observer::OnRegisterContentForTrackingAndRevocationFailure
186 */
188 const std::exception_ptr& error,
189 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
190
191 /**
192 * @brief Called when revocation of is successful
193 *
194 * @param context The same context that was passed to ProtectionEngine::RevokeContentAsync
195 *
196 * @note An application can pass any type of context (for example, std::promise, std::function) to
197 * ProtectionEngine::RevokeContentAsync and that same context will be forwarded as-is to
198 * ProtectionEngine::Observer::OnRevokeContentSuccess or ProtectionEngine::Observer::OnRevokeContentFailure
199 */
201 const std::shared_ptr<void>& context) { UNUSED(context); }
202
203 /**
204 * @brief Called when revocation of content is fails
205 *
206 * @param error Error that occurred while revoking content
207 * @param context The same context that was passed to ProtectionEngine::RevokeContentAsync
208 *
209 * @note An application can pass any type of context (for example, std::promise, std::function) to
210 * ProtectionEngine::RevokeContentAsync and that same context will be forwarded as-is to
211 * ProtectionEngine::Observer::OnRevokeContentSuccess or ProtectionEngine::Observer::OnRevokeContentFailure
212 */
214 const std::exception_ptr& error,
215 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
216
217 /**
218 * @brief Called when create delegated license is successful
219 *
220 * @param context The same context that was passed to ProtectionEngine::CreateDelegationLicensesAsync
221 *
222 * @note An application can pass any type of context (for example, std::promise, std::function) to
223 * ProtectionEngine::CreateDelegationLicensesAsync and that same context will be forwarded as-is to
224 * ProtectionEngine::Observer::OnCreateDelegatedLicensesSuccess or ProtectionEngine::Observer::OnCreateDelegatedLicensesFailure
225 */
227 std::vector<std::shared_ptr<DelegationLicense>> delegatedLicenses,
228 const std::shared_ptr<void>& context) { UNUSED(delegatedLicenses); UNUSED(context); }
229
230 /**
231 * @brief Called when create delegated license fails
232 *
233 * @param error Error that occurred
234 * @param context The same context that was passed to ProtectionEngine::CreateDelegationLicensesAsync
235 *
236 * @note An application can pass any type of context (for example, std::promise, std::function) to
237 * ProtectionEngine::CreateDelegationLicensesAsync and that same context will be forwarded as-is to
238 * ProtectionEngine::Observer::OnCreateDelegatedLicensesSuccess or ProtectionEngine::Observer::OnCreateDelegatedLicensesFailure
239 */
241 const std::exception_ptr& error,
242 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
243
244 /**
245 * @brief Called when GetTenantInformationAsync is successful
246 *
247 * @param context The same context that was passed to ProtectionEngine::GetTenantInformationAsync
248 *
249 * @note An application can pass any type of context (for example, std::promise, std::function) to
250 * ProtectionEngine::GetTenantInformationAsync and that same context will be forwarded as-is to
251 * ProtectionEngine::Observer::OnGetTenantInformationAsyncSuccess or ProtectionEngine::Observer::OnGetTenantInformationAsyncFailure
252 */
254 const std::shared_ptr<TenantInformation>& tenantInformation,
255 const std::shared_ptr<void>& context) { UNUSED(tenantInformation); UNUSED(context); }
256
257 /**
258 * @brief Called when GetTenantInformationAsync fails
259 *
260 * @param error Error that occurred
261 * @param context The same context that was passed to ProtectionEngine::GetTenantInformationAsync
262 *
263 * @note An application can pass any type of context (for example, std::promise, std::function) to
264 * ProtectionEngine::GetTenantInformationAsync and that same context will be forwarded as-is to
265 * ProtectionEngine::Observer::OnGetTenantInformationAsyncSuccess or ProtectionEngine::Observer::OnGetTenantInformationAsyncFailure
266 */
268 const std::exception_ptr& error,
269 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
270
271 /**
272 * @brief Called when license rights data were retrieved successfully
273 *
274 * @param rights A reference to the license rights data retrieved
275 * @param context The same context that was passed to ProtectionEngine::GetLicenseRightsDataAsync
276 *
277 * @note An application can pass any type of context (for example, std::promise, std::function) to
278 * ProtectionEngine::GetLicenseRightsDataAsync and that same context will be forwarded as-is to
279 * ProtectionEngine::Observer::OnGetLicenseRightsDataSuccess or ProtectionEngine::Observer::OnGetLicenseRightsDataFailure
280 */
282 const std::shared_ptr<LicenseRightsData>& licenseRightsData,
283 const std::shared_ptr<void>& context) { UNUSED(licenseRightsData); UNUSED(context); }
284
285 /**
286 * @brief Called when retrieving license rights data fails
287 *
288 * @param error Error that occurred while retrieving license rights data
289 * @param context The same context that was passed to ProtectionEngine::GetLicenseRightsDataAsync
290 *
291 * @note An application can pass any type of context (for example, std::promise, std::function) to
292 * ProtectionEngine::GetLicenseRightsDataAsync and that same context will be forwarded as-is to
293 * ProtectionEngine::Observer::OnGetLicenseRightsDataSuccess or ProtectionEngine::Observer::OnGetLicenseRightsDataFailure
294 */
296 const std::exception_ptr& error,
297 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
298
299 /** @cond DOXYGEN_HIDE */
300 virtual ~Observer() { }
301 protected:
302 Observer() { }
303 /** @endcond */
304 };
305
306 /**
307 * @brief Settings used by ProtectionEngine during its creation and throughout its lifetime
308 */
309 class Settings {
310 public:
311 /**
312 * @brief ProtectionEngine::Settings constructor for creating a new engine
313 *
314 * @param identity Identity that will be associated with ProtectionEngine
315 * @param authDelegate The authentication delegate used by the SDK to acquire authentication tokens, will override the
316 * PolicyProfile::Settings::authDelegate if both provided
317 * @param clientData customizable client data that can be stored with the engine when unloaded and can be retrieved
318 * from a loaded engine.
319 * @param locale Engine output will be provided in this locale.
320 *
321 */
323 const Identity& identity,
324 const std::shared_ptr<AuthDelegate>& authDelegate,
325 const std::string& clientData,
326 const std::string& locale = "")
327 : mIdentity(identity),
328 mAuthDelegate(authDelegate),
329 mClientData(clientData),
330 mLocale(locale),
331 mAllowCloudServiceOnly(false),
332 mTemplateRefreshRate(std::chrono::hours::zero()),
333 mTemplateBatchSize(kMaxTemplateBatchNum) {
334 if (mLocale.compare("") == 0) {
335 mLocale = "en-US";
336 }
337 }
338
339 /**
340 * @brief ProtectionEngine::Settings constructor for loading an existing engine
341 *
342 * @param engineId Unique identifier of engine that will be loaded
343 * @param authDelegate The authentication delegate used by the SDK to acquire authentication tokens, will override the
344 * PolicyProfile::Settings::authDelegate if both provided
345 * @param clientData customizable client data that can be stored with the engine when unloaded and can be retrieved
346 * from a loaded engine.
347 * @param locale Engine output will be provided in this locale.
348 *
349 */
351 const std::string& engineId,
352 const std::shared_ptr<AuthDelegate>& authDelegate,
353 const std::string& clientData,
354 const std::string& locale = "")
355 : mEngineId(engineId),
356 mAuthDelegate(authDelegate),
357 mClientData(clientData),
358 mLocale(locale),
359 mAllowCloudServiceOnly(false),
360 mTemplateRefreshRate(std::chrono::hours::zero()),
361 mTemplateBatchSize(kMaxTemplateBatchNum) {
362 if (mLocale.compare("") == 0) {
363 mLocale = "en-US";
364 }
365 }
366
367 /**
368 * @brief Gets the engine ID.
369 *
370 * @return Engine ID
371 */
372 const std::string& GetEngineId() const { return mEngineId; }
373
374 /**
375 * @brief Sets the engine ID.
376 *
377 * @param engineId engine ID.
378 */
379 void SetEngineId(const std::string& engineId) { mEngineId = engineId; }
380
381 /**
382 * @brief Gets the user Identity associated with the engine
383 *
384 * @return User Identity associated with the engine
385 */
386 const Identity& GetIdentity() const { return mIdentity; }
387
388 /**
389 * @brief Sets the user Identity associated with the engine
390 *
391 * @param identity User Identity associated with the engine
392 */
393 void SetIdentity(const Identity& identity) { mIdentity = identity; }
394
395 /**
396 * @brief Gets custom data specified by client
397 *
398 * @return Custom data specified by client
399 */
400 const std::string& GetClientData() const { return mClientData; }
401
402 /**
403 * @brief Sets custom data specified by client
404 *
405 * @param Custom data specified by client
406 */
407 void SetClientData(const std::string& clientData) { mClientData = clientData; }
408
409 /**
410 * @brief Gets the locale in which engine data will be written
411 *
412 * @return Locale in which engine data will be written
413 */
414 const std::string& GetLocale() const { return mLocale; }
415
416 /**
417 * @brief Sets name/value pairs used for testing and experimentation
418 *
419 * @param customSettings Name/value pairs used for testing and experimentation
420 */
421 void SetCustomSettings(const std::vector<std::pair<std::string, std::string>>& value) { mCustomSettings = value; }
422
423 /**
424 * @brief Gets name/value pairs used for testing and experimentation
425 *
426 * @return Name/value pairs used for testing and experimentation
427 */
428 const std::vector<std::pair<std::string, std::string>>& GetCustomSettings() const { return mCustomSettings; }
429
430 /**
431 * @brief Sets the engine session ID, used for correlation of logging/telemetry
432 *
433 * @param sessionId Engine session ID, used for correlation of logging/telemetry
434 */
435 void SetSessionId(const std::string& sessionId) {
436 mSessionId = sessionId;
437 }
438
439 /**
440 * @brief Gets the engine session ID
441 *
442 * @return Engine session ID
443 */
444 const std::string& GetSessionId() const {
445 return mSessionId;
446 }
447
448 /**
449 * @brief Optionally sets the target cloud
450 *
451 * @param Cloud Cloud
452 *
453 * @note If cloud is not specified, then it will be determined by DNS lookup of the engine's
454 * identity domain if possible, else fall back to global cloud.
455 */
456 void SetCloud(Cloud cloud) {
457 mCloud = cloud;
458 }
459
460 /**
461 * @brief Gets the target cloud used by all service requests
462 *
463 * @return cloud
464 */
465 Cloud GetCloud() const {
466 return mCloud;
467 }
468
469 /**
470 * @brief Optionally sets the target diagnostic region
471 *
472 * @param dataBoundary Data boundary region
473 *
474 * @note If dataBoundary is not specified, then it will default to global diagnostic region.
475 */
476 void SetDataBoundary(DataBoundary dataBoundary) {
477 mDataBoundary = dataBoundary;
478 }
479
480 /**
481 * @brief Gets the data boundary region
482 *
483 * @return DataBoundary
484 */
486 return mDataBoundary;
487 }
488
489 /**
490 * @brief Sets the cloud endpoint base URL for custom cloud
491 *
492 * @param cloudEndpointBaseUrl the base URL used by all service requests (for example, "https://api.aadrm.com")
493 *
494 * @note This value will only be read and must be set for Cloud = Custom
495 */
496 void SetCloudEndpointBaseUrl(const std::string& cloudEndpointBaseUrl) {
497 mCloudEndpointBaseUrl = cloudEndpointBaseUrl;
498 }
499
500 /**
501 * @brief Gets the cloud base URL used by all service requests, if specified
502 *
503 * @return base URL
504 */
505 const std::string& GetCloudEndpointBaseUrl() const {
506 return mCloudEndpointBaseUrl;
507 }
508
509 /**
510 * @brief Set the Engine Auth Delegate.
511 *
512 * @param authDelegate the Auth delegate
513 */
514 void SetAuthDelegate(const std::shared_ptr<AuthDelegate>& authDelegate) {
515 mAuthDelegate = authDelegate;
516 }
517
518 /**
519 * @brief Get the Engine Auth Delegate.
520 *
521 * @return the Engine Auth Delegate.
522 */
523 std::shared_ptr<AuthDelegate> GetAuthDelegate() const { return mAuthDelegate; }
524
525 /**
526 * @brief Gets the Underlying Application ID.
527 *
528 * @return Underlying Application ID
529 */
530 const std::string& GetUnderlyingApplicationId() const { return mUnderlyingApplicationId; }
531
532 /**
533 * @brief Sets the Underlying Application ID.
534 *
535 * @param UnderlyingApplicationId Underlying Application ID.
536 */
537 void SetUnderlyingApplicationId(const std::string& underlyingApplicationId) { mUnderlyingApplicationId = underlyingApplicationId; }
538
539 /**
540 * @brief Gets whether or not only cloud service is allowed
541 *
542 * @return A boolean value indicating whether or not only cloud service is allowed
543 */
544 bool GetAllowCloudServiceOnly() const { return mAllowCloudServiceOnly; }
545
546 /**
547 * @brief Sets whether or not only cloud service is allowed
548 *
549 * @param allowCloudServiceOnly A boolean value indicating whether or not only cloud service is allowed
550 */
551 void SetAllowCloudServiceOnly(bool allowCloudServiceOnly) { mAllowCloudServiceOnly = allowCloudServiceOnly; }
552
553 /**
554 * @brief Gets the refresh rate of the protection templates
555 *
556 * @return The refresh rate of protection templates as chrono::hours
557 *
558 * @note A refresh rate of 0 hours means that templates will always be fetched from the service and never cached
559 */
560 std::chrono::hours GetTemplateRefreshInterval() const { return mTemplateRefreshRate; }
561
562 /**
563 * @brief Gets the number of templates to be requested in each batch during GetTemplates
564 *
565 * @return The number of full template data requests per batch if offline publishing is enabled
566 */
567 int GetTemplateBatchSize() const { return mTemplateBatchSize; }
568
569 /**
570 * @brief Sets a custom refresh rate for templates.
571 *
572 * @warning Engines will not refresh automatically on that interval, only on engine call to GetTemplates or GetTemplatesAsync
573 *
574 * @param templateRefreshRateHours How often to allow use of cached templates for protection.
575 * will always refresh by default. If hours are less than 0 will throw exception.
576 * @param templateBatchSize If offline protection is enabled, how many template data responses
577 * are carried in a single request during fetching. Between 1 and 25.
578 *
579 * @note Will only refresh templates if outside of interval during an API that uses them. Will not automatically
580 * refresh in background.
581 */
582 void SetTemplateRefreshArgs(std::chrono::hours templateRefreshRateHours, int templateBatchSize = kMaxTemplateBatchNum) {
583 if (templateRefreshRateHours < std::chrono::hours::zero()) {
584 throw BadInputError("Template refresh interval is outside acceptable range.");
585 }
586 mTemplateRefreshRate = templateRefreshRateHours;
587
588 if (templateBatchSize < kMinTemplateBatchNum || templateBatchSize > kMaxTemplateBatchNum) {
589 throw BadInputError("Template batch size is outside acceptable range.");
590 }
591 mTemplateBatchSize = templateBatchSize;
592 }
593
594 /**
595 * @brief Add a capability which will be passed along to RMS when fetching usage rights
596 *
597 * @param capability The header representing a capability that RMS should support
598 */
599 MIP_API void AddRmsCapability(const std::string& capability);
600
601 /**
602 * @brief Remove one of the added usage rights capabilities which get passed to RMS
603 *
604 * @param capability The capability which should be removed.
605 */
606 MIP_API bool RemoveRmsCapability(const std::string& capability);
607
608 /**
609 * @brief The the full set of client capabilities supported when fetching usage rights from RMS.
610 */
611 std::vector<std::string> GetRmsCapabilities() const { return mCapabilities; }
612
613#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
614 /**
615 * @brief Get logger context that will be opaquely passed to the logger delegate for logs associated with the created engine
616 *
617 * @return The logger context
618 */
619 const std::shared_ptr<void>& GetLoggerContext() const { return mLoggerContext; }
620#endif
621
622 /**
623 * @brief Sets the logger context that will be opaquely passed to the logger delegate for logs associated with the created engine
624 *
625 * @param loggerContext The logger context
626 *
627 */
628 void SetLoggerContext(const std::shared_ptr<void>& loggerContext) {
629 mLoggerContext = loggerContext;
630 }
631
632 /** @cond DOXYGEN_HIDE */
633 private:
634 std::string mEngineId;
635 Identity mIdentity;
636 Cloud mCloud = Cloud::Unknown;
637 DataBoundary mDataBoundary = DataBoundary::Default;
638 std::shared_ptr<AuthDelegate> mAuthDelegate;
639 std::string mClientData;
640 std::vector<std::pair<std::string, std::string>> mCustomSettings;
641 std::vector<std::string> mCapabilities;
642 std::string mCloudEndpointBaseUrl;
643 std::string mLocale;
644 std::string mSessionId;
645 std::string mUnderlyingApplicationId;
646 bool mAllowCloudServiceOnly;
647 std::chrono::hours mTemplateRefreshRate;
648 int mTemplateBatchSize;
649 std::shared_ptr<void> mLoggerContext;
650 /** @endcond */
651 };
652
653 /**
654 * @brief Gets the engine settings
655 *
656 * @return Engine settings
657 */
658 virtual const Settings& GetSettings() const = 0;
659
660 /**
661 * @brief Get collection of templates available to a user
662 *
663 * @param observer A class implementing the ProtectionEngine::Observer interface
664 * @param context Client context that will be opaquely passed back to observers and optional HttpDelegate
665 * @param templateSettings Settings to use when obtaining templates
666 *
667 * @return Async control object.
668 */
669 virtual std::shared_ptr<AsyncControl> GetTemplatesAsync(
670 const std::shared_ptr<ProtectionEngine::Observer>& observer,
671 const std::shared_ptr<void>& context,
672 const std::shared_ptr<const GetTemplatesSettings>& templateSettings) = 0;
673
674 /**
675 * @brief Get collection of templates available to a user
676 *
677 * @param observer A class implementing the ProtectionEngine::Observer interface
678 * @param context Client context that will be opaquely passed back to observers and optional HttpDelegate
679 *
680 * @return Async control object.
681 */
682 virtual std::shared_ptr<AsyncControl> GetTemplatesAsync(
683 const std::shared_ptr<ProtectionEngine::Observer>& observer,
684 const std::shared_ptr<void>& context) = 0;
685
686 /**
687 * @brief Get collection of templates available to a user
688 *
689 * @param context Client context that will be opaquely passed to optional HttpDelegate
690 * @param templateSettings Settings to use when obtaining templates
691 *
692 * @return List of template IDs
693 */
694 virtual std::vector<std::shared_ptr<TemplateDescriptor>> GetTemplates(
695 const std::shared_ptr<void>& context,
696 const std::shared_ptr<const GetTemplatesSettings>& templateSettings) = 0;
697
698 /**
699 * @brief Get collection of templates available to a user
700 *
701 * @param context Client context that will be opaquely passed to optional HttpDelegate
702 *
703 * @return List of template IDs
704 */
705 virtual std::vector<std::shared_ptr<TemplateDescriptor>> GetTemplates(const std::shared_ptr<void>& context) = 0;
706
707 /**
708 * @brief Check is feature supported
709 *
710 * @param featureId id of feature to check
711 *
712 * @return boolean result
713 */
714 virtual bool IsFeatureSupported(FeatureId featureId) = 0;
715
716 /**
717 * @brief Get collection of rights available to a user for a label ID
718 *
719 * @param documentId Document ID associated with the document metadata
720 * @param labelId Label ID associated with the document metadata with which the document created
721 * @param ownerEmail owner of the document
722 * @param delegatedUserEmail A delegated user is specified when the authenticating user/application is acting on
723 * behalf of another user, empty if none
724 * @param observer A class implementing the ProtectionEngine::Observer interface
725 * @param context This same context will be forwarded to ProtectionEngine::Observer::OnGetRightsForLabelIdSuccess
726 * or ProtectionEngine::Observer::OnGetRightsForLabelIdFailure
727 *
728 * @return Async control object.
729 */
730 virtual std::shared_ptr<AsyncControl> GetRightsForLabelIdAsync(
731 const std::string& documentId,
732 const std::string& labelId,
733 const std::string& ownerEmail,
734 const std::string& delegatedUserEmail,
735 const std::shared_ptr<ProtectionEngine::Observer>& observer,
736 const std::shared_ptr<void>& context,
737 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
738
739 /**
740 * @brief Get collection of rights available to a user for a labelId
741 *
742 * @param documentId Document ID associated with the document metadata
743 * @param labelId Label ID associated with the document metadata with which the document created
744 * @param ownerEmail Owner of the document
745 * @param delegatedUserEmail A delegated user is specified when the authenticating user/application is acting on
746 * behalf of another user empty if none
747 * @param context This same context will be forwarded to optional HttpDelegate
748 *
749 * @return List of rights
750 */
751 virtual std::vector<std::string> GetRightsForLabelId(
752 const std::string& documentId,
753 const std::string& labelId,
754 const std::string& ownerEmail,
755 const std::string& delegatedUserEmail,
756 const std::shared_ptr<void>& context,
757 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
758
759 /**
760 * @brief Get the collection of properties (including usage rights) associated with a user for a given label ID.
761 *
762 * @param documentId Document ID associated with the document metadata
763 * @param labelId Label ID associated with the document metadata with which the document created
764 * @param ownerEmail Owner of the document
765 * @param delegatedUserEmail Delegated user is specified when the authenticating user/application is acting on behalf
766 * of another user, empty if none
767 * @param context This same context will be forwarded to optional HttpDelegate
768 * @param settings The protection common settings
769 *
770 * @return A shared pointer to the licenseinfo object
771 */
772 virtual std::shared_ptr<mip::LicenseInfo> GetLicenseInfoForLabelId(
773 const std::string& documentId,
774 const std::string& labelId,
775 const std::string& ownerEmail,
776 const std::string& delegatedUserEmail,
777 const std::shared_ptr<void>& context,
778 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
779
780 /**
781 * @brief Creates a protection handler where rights/roles are assigned to specific users
782 *
783 * @param settings Protection settings
784 * @param observer A class implementing the ProtectionHandler::Observer interface
785 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
786 *
787 * @return Async control object.
788 *
789 * @note If settings are offline only, engine needs to have previously called GetTemplatesAsync and LoadUserCertAsync
790 */
791 virtual std::shared_ptr<AsyncControl> CreateProtectionHandlerForPublishingAsync(
793 const std::shared_ptr<ProtectionHandler::Observer>& observer,
794 const std::shared_ptr<void>& context) = 0;
795
796 /**
797 * @brief Creates a protection handler where rights/roles are assigned to specific users
798 *
799 * @param settings Protection settings
800 * @param context Client context that will be opaquely forwarded to optional HttpDelegate
801 *
802 * @return ProtectionHandler
803 *
804 * @note If settings are offline only, engine needs to have previously called GetTemplates and LoadUserCert
805 */
806 virtual std::shared_ptr<ProtectionHandler> CreateProtectionHandlerForPublishing(
808 const std::shared_ptr<void>& context) = 0;
809
810 /**
811 * @brief Creates a protection handler where rights/roles are assigned to specific users
812 *
813 * @param settings Protection settings
814 * @param observer A class implementing the ProtectionHandler::Observer interface
815 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
816 *
817 * @return Async control object.
818 */
819 virtual std::shared_ptr<AsyncControl> CreateProtectionHandlerForConsumptionAsync(
821 const std::shared_ptr<ProtectionHandler::Observer>& observer,
822 const std::shared_ptr<void>& context) = 0;
823
824 /**
825 * @brief Creates a protection handler where rights/roles are assigned to specific users
826 *
827 * @param settings Protection settings
828 * @param context Client context that will be opaquely forwarded to optional HttpDelegate
829 *
830 * @return ProtectionHandler
831 */
832 virtual std::shared_ptr<ProtectionHandler> CreateProtectionHandlerForConsumption(
834 const std::shared_ptr<void>& context) = 0;
835
836 /**
837 * @brief pre-emptively load user licensor certificate, useful when background loading else using prelicense might
838 * incurr an additional network call.
839 *
840 * @param context Client context that will be opaquely forwarded to optional HttpDelegate
841 *
842 * @return true if loaded successfully else false.
843 */
844#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
845 [[deprecated("ProtectionEngine::LoadUserCert is deprecated, use ProtectionEngine::LoadUserCertSync")]]
846#endif
847 virtual bool LoadUserCert(
848 const std::shared_ptr<void>& context,
850 try {
851 LoadUserCertSync(context, settings);
852 } catch (...) {
853 return false;
854 }
855 return true;
856 }
857
858 /**
859 * @brief pre-emptively load user licensor certificate, useful when background loading else using prelicense might
860 * incurr an additional network call.
861 *
862 * @param context Client context that will be opaquely forwarded to optional HttpDelegate
863 * @param settings Settings to control general protection behavior
864 */
865 virtual void LoadUserCertSync(
866 const std::shared_ptr<void>& context,
867 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
868
869 /**
870 * @brief pre-emptively load user licensor certificate, useful when background loading else using prelicense might
871 * incurr an additional network call.
872 *
873 * @param observer A class implementing the ProtectionHandler::Observer interface
874 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
875 *
876 * @return Async control object.
877 */
878 virtual std::shared_ptr<AsyncControl> LoadUserCertAsync(
879 const std::shared_ptr<ProtectionEngine::Observer>& observer,
880 const std::shared_ptr<void>& context,
881 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
882
883 /**
884 * @brief Register publishing license (PL) for document tracking & revocation
885 *
886 * @param contentName The name to associated with the content specified by the serializedPublishingLicense. If the serializedPublishingLicense specifies a content name, that value will take precedence.
887 * @param isOwnerNotificationEnabled Set to true to notify the owner via email whenever the document is decrypted, or false to not send the notification.
888 * @param context Client context that will be opaquely forwarded to optional HttpDelegate
889 */
891 const std::vector<uint8_t>& serializedPublishingLicense,
892 const std::string& contentName,
893 bool isOwnerNotificationEnabled,
894 const std::shared_ptr<void>& context,
895 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
896
897 /**
898 * @brief Register publishing license (PL) for document tracking & revocation
899 *
900 * @param serializedPublishingLicense Serialized publishing license from protected content
901 * @param contentName The name to associated with the content specified by the serializedPublishingLicense. If the serializedPublishingLicense specifies a content name, that value will take precedence
902 * @param isOwnerNotificationEnabled Set to true to notify the owner via email whenever the document is decrypted, or false to not send the notification.
903 * @param observer A class implementing the ProtectionHandler::Observer interface
904 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
905 *
906 * @return Async control object.
907 */
908 virtual std::shared_ptr<AsyncControl> RegisterContentForTrackingAndRevocationAsync(
909 const std::vector<uint8_t>& serializedPublishingLicense,
910 const std::string& contentName,
911 bool isOwnerNotificationEnabled,
912 const std::shared_ptr<ProtectionEngine::Observer>& observer,
913 const std::shared_ptr<void>& context,
914 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
915
916 /**
917 * @brief Perform revocation for content
918 *
919 * @param serializedPublishingLicense Serialized publishing license from protected content
920 * @param context Client context that will be opaquely forwarded to optional HttpDelegate
921 */
922 virtual void RevokeContent(
923 const std::vector<uint8_t>& serializedPublishingLicense,
924 const std::shared_ptr<void>& context,
925 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
926
927 /**
928 * @brief Perform revocation for content
929 *
930 * @param serializedPublishingLicense Serialized publishing license from protected content
931 * @param observer A class implementing the ProtectionHandler::Observer interface
932 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
933 *
934 * @return Async control object.
935 */
936 virtual std::shared_ptr<AsyncControl> RevokeContentAsync(
937 const std::vector<uint8_t>& serializedPublishingLicense,
938 const std::shared_ptr<ProtectionEngine::Observer>& observer,
939 const std::shared_ptr<void>& context,
940 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
941
942 /**
943 * @brief Creates a delegated license
944 *
945 * @param settings The delegation settings
946 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
947 *
948 * @return A vector of the delegation licenses
949 *
950 * @note Use this method to create licenses for a list of users
951 */
952 virtual std::vector<std::shared_ptr<DelegationLicense>> CreateDelegationLicenses(
953 const DelegationLicenseSettings& settings,
954 const std::shared_ptr<void>& context) = 0;
955
956 /**
957 * @brief Creates a delegated license
958 *
959 * @param settings The delegation settings
960 * @param observer A class implementing the ProtectionHandler::Observer interface
961 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
962 *
963 * @return Async control object.
964 *
965 * @note Use this method to create licenses for a list of users.
966 * Receive the DelegationLicense vector in callback OnCreateDelegatedLicensesSuccess
967 * Failures are sent in OnCreateDelegatedLicensesFailure
968 */
969 virtual std::shared_ptr<AsyncControl> CreateDelegationLicensesAsync(
970 const DelegationLicenseSettings& settings,
971 const std::shared_ptr<ProtectionEngine::Observer>& observer,
972 const std::shared_ptr<void>& context) = 0;
973
974 /**
975 * @brief Loads user licensor certificate and returns information about the tenant
976 *
977 * @param settings The common settings
978 * @param context Client context that will be opaquely forwarded to optional HttpDelegate
979 *
980 * @return TenantInformation
981 */
982 virtual std::shared_ptr<TenantInformation> GetTenantInformation(
983 const ProtectionCommonSettings& settings,
984 const std::shared_ptr<void>& context) = 0;
985
986 /**
987 * @brief Loads user licensor certificate and returns information about the tenant
988 *
989 * @param settings The common settings
990 * @param observer A class implementing the ProtectionHandler::Observer interface
991 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
992 *
993 * @return Async control object.
994 *
995 * @note - ProtectionEngine::Observer::OnGetTenantInformationAsyncSuccess will be called on success
996 * ProtectionEngine::Observer::OnGetTenantInformationAsyncFailure will be called on failure
997 */
998 virtual std::shared_ptr<AsyncControl> GetTenantInformationAsync(
999 const ProtectionCommonSettings& settings,
1000 const std::shared_ptr<ProtectionEngine::Observer>& observer,
1001 const std::shared_ptr<void>& context) = 0;
1002
1003 /**
1004 * @brief Get the rights data for a license.
1005 * This method requires the requesting identity to be included in the super user list for your organization.
1006 * Alternatively, the identity must have been granted VIEWRIGHTSDATA, EDITRIGHTSDATA, or OWNER rights to the content.
1007 *
1008 * @param serializedPublishingLicense Serialized publishing license from protected content
1009 * @param context Client context that will be opaquely forwarded to optional HttpDelegate
1010 * @param settings The common settings
1011 *
1012 * @return The license rights data
1013 */
1014 virtual std::shared_ptr<LicenseRightsData> GetLicenseRightsData(
1015 const std::vector<uint8_t>& serializedPublishingLicense,
1016 const std::shared_ptr<void>& context,
1017 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
1018
1019 /**
1020 * @brief Get the rights data for a license.
1021 * This method requires the requesting identity to be included in the super user list for your organization.
1022 * Alternatively, the identity must have been granted VIEWRIGHTSDATA, EDITRIGHTSDATA, or OWNER rights to the content.
1023 *
1024 * @param serializedPublishingLicense Serialized publishing license from protected content
1025 * @param observer A class implementing the ProtectionHandler::Observer interface
1026 * @param context Client context that will be opaquely forwarded to observers and optional HttpDelegate
1027 * @param settings The common settings
1028 *
1029 * @return Async control object.
1030 */
1031 virtual std::shared_ptr<AsyncControl> GetLicenseRightsDataAsync(
1032 const std::vector<uint8_t>& serializedPublishingLicense,
1033 const std::shared_ptr<ProtectionEngine::Observer>& observer,
1034 const std::shared_ptr<void>& context,
1035 const ProtectionCommonSettings& settings = ProtectionCommonSettings()) = 0;
1036
1037 /** @cond DOXYGEN_HIDE */
1038 virtual ~ProtectionEngine() {}
1039protected:
1040 ProtectionEngine() {}
1041 /** @endcond */
1042};
1043
1044MIP_NAMESPACE_END
1045
1046#endif // API_MIP_PROTECTION_PROTECTION_ENGINE_H_
Bad input error, thrown when the input to an SDK API is invalid.
Definition error.h:247
Abstraction for identity.
Settings to use for protection operations.
Interface that receives notifications related to ProtectionEngine.
virtual void OnRevokeContentSuccess(const std::shared_ptr< void > &context)
Called when revocation of is successful.
virtual void OnCreateDelegatedLicensesFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when create delegated license fails.
virtual void OnGetTenantInformationAsyncFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when GetTenantInformationAsync fails.
virtual void OnGetTenantInformationAsyncSuccess(const std::shared_ptr< TenantInformation > &tenantInformation, const std::shared_ptr< void > &context)
Called when GetTenantInformationAsync is successful.
virtual void OnGetTemplatesFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when retrieving templates generated an error.
virtual void OnLoadUserCertSuccess(const std::shared_ptr< void > &context)
Called when user cert loaded successfully.
virtual void OnRegisterContentForTrackingAndRevocationSuccess(const std::shared_ptr< void > &context)
Called when registration of content for tracking & revocation is successful.
virtual void OnGetLicenseRightsDataSuccess(const std::shared_ptr< LicenseRightsData > &licenseRightsData, const std::shared_ptr< void > &context)
Called when license rights data were retrieved successfully.
virtual void OnGetTemplatesSuccess(const std::vector< std::shared_ptr< TemplateDescriptor > > &templateDescriptors, const std::shared_ptr< void > &context)
Called when templates were retrieved successfully.
virtual void OnRevokeContentFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when revocation of content is fails.
virtual void OnCreateDelegatedLicensesSuccess(std::vector< std::shared_ptr< DelegationLicense > > delegatedLicenses, const std::shared_ptr< void > &context)
Called when create delegated license is successful.
virtual void OnGetLicenseRightsDataFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when retrieving license rights data fails.
virtual void OnGetRightsForLabelIdSuccess(const std::shared_ptr< std::vector< std::string > > &rights, const std::shared_ptr< void > &context)
Called when rights were retrieved successfully.
virtual void OnRegisterContentForTrackingAndRevocationFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when registration of content for tracking & revocation fails.
virtual void OnLoadUserCertFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when user cert loaded failed.
virtual void OnGetRightsForLabelIdFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when retrieving rights for a label ID for the user.
Settings used by ProtectionEngine during its creation and throughout its lifetime.
const std::string & GetSessionId() const
Gets the engine session ID.
MIP_API void AddRmsCapability(const std::string &capability)
Add a capability which will be passed along to RMS when fetching usage rights.
const std::string & GetCloudEndpointBaseUrl() const
Gets the cloud base URL used by all service requests, if specified.
void SetCustomSettings(const std::vector< std::pair< std::string, std::string > > &value)
Sets name/value pairs used for testing and experimentation.
std::chrono::hours GetTemplateRefreshInterval() const
Gets the refresh rate of the protection templates.
void SetDataBoundary(DataBoundary dataBoundary)
Optionally sets the target diagnostic region.
const std::vector< std::pair< std::string, std::string > > & GetCustomSettings() const
Gets name/value pairs used for testing and experimentation.
void SetIdentity(const Identity &identity)
Sets the user Identity associated with the engine.
DataBoundary GetDataBoundary() const
Gets the data boundary region.
void SetClientData(const std::string &clientData)
Sets custom data specified by client.
bool GetAllowCloudServiceOnly() const
Gets whether or not only cloud service is allowed.
Settings(const std::string &engineId, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="")
ProtectionEngine::Settings constructor for loading an existing engine.
const std::string & GetClientData() const
Gets custom data specified by client.
Cloud GetCloud() const
Gets the target cloud used by all service requests.
Settings(const Identity &identity, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="")
ProtectionEngine::Settings constructor for creating a new engine.
MIP_API bool RemoveRmsCapability(const std::string &capability)
Remove one of the added usage rights capabilities which get passed to RMS.
const Identity & GetIdentity() const
Gets the user Identity associated with the engine.
void SetCloud(Cloud cloud)
Optionally sets the target cloud.
void SetTemplateRefreshArgs(std::chrono::hours templateRefreshRateHours, int templateBatchSize=kMaxTemplateBatchNum)
Sets a custom refresh rate for templates.
void SetEngineId(const std::string &engineId)
Sets the engine ID.
int GetTemplateBatchSize() const
Gets the number of templates to be requested in each batch during GetTemplates.
void SetSessionId(const std::string &sessionId)
Sets the engine session ID, used for correlation of logging/telemetry.
void SetAuthDelegate(const std::shared_ptr< AuthDelegate > &authDelegate)
Set the Engine Auth Delegate.
const std::string & GetUnderlyingApplicationId() const
Gets the Underlying Application ID.
void SetAllowCloudServiceOnly(bool allowCloudServiceOnly)
Sets whether or not only cloud service is allowed.
const std::shared_ptr< void > & GetLoggerContext() const
Get logger context that will be opaquely passed to the logger delegate for logs associated with the c...
void SetLoggerContext(const std::shared_ptr< void > &loggerContext)
Sets the logger context that will be opaquely passed to the logger delegate for logs associated with ...
const std::string & GetEngineId() const
Gets the engine ID.
void SetUnderlyingApplicationId(const std::string &underlyingApplicationId)
Sets the Underlying Application ID.
std::shared_ptr< AuthDelegate > GetAuthDelegate() const
Get the Engine Auth Delegate.
std::vector< std::string > GetRmsCapabilities() const
The the full set of client capabilities supported when fetching usage rights from RMS.
const std::string & GetLocale() const
Gets the locale in which engine data will be written.
void SetCloudEndpointBaseUrl(const std::string &cloudEndpointBaseUrl)
Sets the cloud endpoint base URL for custom cloud.
Manages protection-related actions related to a specific identity.
virtual std::shared_ptr< AsyncControl > LoadUserCertAsync(const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
pre-emptively load user licensor certificate, useful when background loading else using prelicense mi...
virtual std::shared_ptr< AsyncControl > GetLicenseRightsDataAsync(const std::vector< uint8_t > &serializedPublishingLicense, const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Get the rights data for a license. This method requires the requesting identity to be included in the...
virtual std::shared_ptr< mip::LicenseInfo > GetLicenseInfoForLabelId(const std::string &documentId, const std::string &labelId, const std::string &ownerEmail, const std::string &delegatedUserEmail, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Get the collection of properties (including usage rights) associated with a user for a given label ID...
virtual void RevokeContent(const std::vector< uint8_t > &serializedPublishingLicense, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Perform revocation for content.
virtual std::vector< std::string > GetRightsForLabelId(const std::string &documentId, const std::string &labelId, const std::string &ownerEmail, const std::string &delegatedUserEmail, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Get collection of rights available to a user for a labelId.
virtual std::shared_ptr< AsyncControl > RevokeContentAsync(const std::vector< uint8_t > &serializedPublishingLicense, const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Perform revocation for content.
virtual std::shared_ptr< AsyncControl > GetTemplatesAsync(const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context, const std::shared_ptr< const GetTemplatesSettings > &templateSettings)=0
Get collection of templates available to a user.
virtual std::shared_ptr< AsyncControl > CreateDelegationLicensesAsync(const DelegationLicenseSettings &settings, const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context)=0
Creates a delegated license.
virtual std::shared_ptr< AsyncControl > CreateProtectionHandlerForConsumptionAsync(const ProtectionHandler::ConsumptionSettings &settings, const std::shared_ptr< ProtectionHandler::Observer > &observer, const std::shared_ptr< void > &context)=0
Creates a protection handler where rights/roles are assigned to specific users.
virtual std::vector< std::shared_ptr< TemplateDescriptor > > GetTemplates(const std::shared_ptr< void > &context)=0
Get collection of templates available to a user.
virtual void RegisterContentForTrackingAndRevocation(const std::vector< uint8_t > &serializedPublishingLicense, const std::string &contentName, bool isOwnerNotificationEnabled, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Register publishing license (PL) for document tracking & revocation.
virtual std::vector< std::shared_ptr< TemplateDescriptor > > GetTemplates(const std::shared_ptr< void > &context, const std::shared_ptr< const GetTemplatesSettings > &templateSettings)=0
Get collection of templates available to a user.
virtual std::shared_ptr< ProtectionHandler > CreateProtectionHandlerForPublishing(const ProtectionHandler::PublishingSettings &settings, const std::shared_ptr< void > &context)=0
Creates a protection handler where rights/roles are assigned to specific users.
virtual bool LoadUserCert(const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())
pre-emptively load user licensor certificate, useful when background loading else using prelicense mi...
virtual std::shared_ptr< AsyncControl > CreateProtectionHandlerForPublishingAsync(const ProtectionHandler::PublishingSettings &settings, const std::shared_ptr< ProtectionHandler::Observer > &observer, const std::shared_ptr< void > &context)=0
Creates a protection handler where rights/roles are assigned to specific users.
virtual std::vector< std::shared_ptr< DelegationLicense > > CreateDelegationLicenses(const DelegationLicenseSettings &settings, const std::shared_ptr< void > &context)=0
Creates a delegated license.
virtual std::shared_ptr< ProtectionHandler > CreateProtectionHandlerForConsumption(const ProtectionHandler::ConsumptionSettings &settings, const std::shared_ptr< void > &context)=0
Creates a protection handler where rights/roles are assigned to specific users.
virtual std::shared_ptr< AsyncControl > GetRightsForLabelIdAsync(const std::string &documentId, const std::string &labelId, const std::string &ownerEmail, const std::string &delegatedUserEmail, const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Get collection of rights available to a user for a label ID.
virtual bool IsFeatureSupported(FeatureId featureId)=0
Check is feature supported.
virtual std::shared_ptr< TenantInformation > GetTenantInformation(const ProtectionCommonSettings &settings, const std::shared_ptr< void > &context)=0
Loads user licensor certificate and returns information about the tenant.
virtual std::shared_ptr< AsyncControl > GetTenantInformationAsync(const ProtectionCommonSettings &settings, const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context)=0
Loads user licensor certificate and returns information about the tenant.
virtual void LoadUserCertSync(const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
pre-emptively load user licensor certificate, useful when background loading else using prelicense mi...
virtual std::shared_ptr< AsyncControl > RegisterContentForTrackingAndRevocationAsync(const std::vector< uint8_t > &serializedPublishingLicense, const std::string &contentName, bool isOwnerNotificationEnabled, const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Register publishing license (PL) for document tracking & revocation.
virtual std::shared_ptr< LicenseRightsData > GetLicenseRightsData(const std::vector< uint8_t > &serializedPublishingLicense, const std::shared_ptr< void > &context, const ProtectionCommonSettings &settings=ProtectionCommonSettings())=0
Get the rights data for a license. This method requires the requesting identity to be included in the...
virtual const Settings & GetSettings() const =0
Gets the engine settings.
virtual std::shared_ptr< AsyncControl > GetTemplatesAsync(const std::shared_ptr< ProtectionEngine::Observer > &observer, const std::shared_ptr< void > &context)=0
Get collection of templates available to a user.
Settings used to create a ProtectionHandler to consume existing content.
Settings used to create a ProtectionHandler to protect new content.
A file Containing the common types used by the upe, file and protection modules.
FeatureId
Defines new features by name.
Cloud
Azure cloud identifier.
DataBoundary
Diagnostic region identifier.
Defines DelegationLicense interface.
Defines DelegationLicenseSettings class.
A file containing the MIP SDK error types.
Defines GetTemplatesSettings interface.
Defines LicenseInfo interface.
Defines LicenseRightstData interface.
A file export/import macros.
MIP namespace macros.
A file containing the common types used by the protection module.
Defines ProtectionDescriptor interface.
Defines ProtectionHandler interface.
Defines TemplateDescriptor interface.
Defines TenantInformation interface.