Microsoft Information Protection SDK - C++ 1.18
API Reference Documentation for C++
Loading...
Searching...
No Matches
protection_descriptor.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 */
33#ifndef API_MIP_PROTECTION_DESCRIPTOR_H_
34#define API_MIP_PROTECTION_DESCRIPTOR_H_
35
36#include <chrono>
37#include <map>
38#include <memory>
39#include <string>
40
41#include "mip/mip_namespace.h"
42#include "mip/user_rights.h"
43#include "mip/user_roles.h"
45
46MIP_NAMESPACE_BEGIN
47
51enum class ProtectionType {
52 TemplateBased = 0,
53 Custom = 1,
54 Dynamic = 2,
55};
56
61struct LabelInfo {
62 LabelInfo(const std::string& _labelId, const std::string& _tenantId) {
63 labelId = _labelId;
64 tenantId = _tenantId;
65 }
66 std::string labelId;
67 std::string tenantId;
68};
69
74public:
75
81 virtual ProtectionType GetProtectionType() const = 0;
82
88 virtual std::string GetOwner() const = 0;
89
95 virtual std::string GetName() const = 0;
96
102 virtual std::string GetDescription() const = 0;
103
109 virtual std::string GetTemplateId() const = 0;
110
119 virtual LabelInfo GetLabelInfo() const = 0;
120
129 virtual std::string GetLabelId() const = 0;
130
139 virtual std::string GetContentId() const = 0;
140
149 virtual std::vector<UserRights> GetUserRights() const = 0;
150
156 virtual std::vector<UserRoles> GetUserRoles() const = 0;
157
163 virtual bool DoesContentExpire() const = 0;
164
170 virtual std::chrono::time_point<std::chrono::system_clock> GetContentValidUntil() const = 0;
171
179 bool DoesLicenseExpire() const {
180 return GetLicenseValidUntil().time_since_epoch().count() != 0;
181 }
182
183
192 virtual std::chrono::time_point<std::chrono::system_clock> GetLicenseValidUntil() const {
193 return std::chrono::system_clock::from_time_t(0);
194 }
195
201 virtual bool DoesAllowOfflineAccess() const = 0;
202
211 virtual std::string GetReferrer() const = 0;
212
221 virtual std::map<std::string, std::string> GetEncryptedAppData() const = 0;
222
231 virtual std::map<std::string, std::string> GetSignedAppData() const = 0;
232
240 virtual std::string GetDoubleKeyUrl() const = 0;
241
247 virtual std::shared_ptr<const std::vector<uint8_t>> GetSerializedTemplate() const = 0;
248
254 virtual std::shared_ptr<const DynamicWatermark> GetDynamicWatermark() const = 0;
255
263 virtual std::string GetSupplementalInfo(const std::string& dataNeeded) const = 0;
264
266 virtual ~ProtectionDescriptor() {}
267protected:
270};
271
272MIP_NAMESPACE_END
273
274#endif //API_MIP_PROTECTION_DESCRIPTOR_H_
Description of protection associated with a piece of content.
Definition protection_descriptor.h:73
virtual std::map< std::string, std::string > GetSignedAppData() const =0
Gets the app-specific data that was signed.
virtual std::chrono::time_point< std::chrono::system_clock > GetLicenseValidUntil() const
Gets protection license expiration time.
Definition protection_descriptor.h:192
virtual std::map< std::string, std::string > GetEncryptedAppData() const =0
Gets app-specific data that was encrypted.
virtual std::string GetContentId() const =0
Gets the Content ID, if any.
virtual std::shared_ptr< const std::vector< uint8_t > > GetSerializedTemplate() const =0
Gets the serialized template, if any.
virtual std::string GetReferrer() const =0
Gets protection referrer address.
virtual std::string GetDoubleKeyUrl() const =0
Gets the double key url to be used for custom protection.
virtual std::vector< UserRights > GetUserRights() const =0
Gets collection of users-to-rights mappings.
virtual LabelInfo GetLabelInfo() const =0
Gets the label Info, if any.
virtual std::shared_ptr< const DynamicWatermark > GetDynamicWatermark() const =0
Gets the dynamic watermark configured for this content if any.
virtual std::string GetDescription() const =0
Gets protection description.
virtual std::string GetOwner() const =0
Gets owner for the protection.
virtual std::string GetSupplementalInfo(const std::string &dataNeeded) const =0
Get supplemental information associated with this ProtectionDescriptor.
virtual std::string GetLabelId() const =0
Gets the label ID, if any.
virtual std::chrono::time_point< std::chrono::system_clock > GetContentValidUntil() const =0
Gets protection expiration time.
virtual std::string GetTemplateId() const =0
Gets the protection template ID, if any.
virtual ProtectionType GetProtectionType() const =0
Gets type of protection, whether it originated from protection SDK template or not.
bool DoesLicenseExpire() const
Checks if license has an expiration time or not.
Definition protection_descriptor.h:179
virtual bool DoesContentExpire() const =0
Checks if content has an expiration time or not.
virtual std::vector< UserRoles > GetUserRoles() const =0
Gets collection of users-to-roles mappings.
virtual bool DoesAllowOfflineAccess() const =0
Gets if protection allows offline content access or not.
virtual std::string GetName() const =0
Gets protection name.
Defines DynamicWatermark interface.
MIP namespace macros.
ProtectionType
Describes whether protection is based off a template, ad-hoc (custom), or dynamically by the service....
Definition protection_descriptor.h:51
Label information for a template or ad-hoc (custom) protection.
Definition protection_descriptor.h:61
LabelInfo(const std::string &_labelId, const std::string &_tenantId)
Definition protection_descriptor.h:62
std::string labelId
Definition protection_descriptor.h:66
std::string tenantId
Definition protection_descriptor.h:67
Defines UserRights class.
Defines UserRoles class.