Microsoft Information Protection SDK - C++ 1.17
API Reference Documentation for C++
Loading...
Searching...
No Matches
protection_descriptor_builder.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_BUILDER_H_
34#define API_MIP_PROTECTION_DESCRIPTOR_BUILDER_H_
35
36#include <map>
37
38#include "mip/mip_export.h"
39#include "mip/mip_namespace.h"
41#include "mip/user_rights.h"
42#include "mip/user_roles.h"
43
44MIP_NAMESPACE_BEGIN
45
50public:
54 enum class LicenseType {
58 DoNotForward = 0,
63 };
64
72 MIP_API static std::shared_ptr<ProtectionDescriptorBuilder> CreateFromUserRights(
73 const std::vector<UserRights>& usersAndRights);
74
82 MIP_API static std::shared_ptr<ProtectionDescriptorBuilder> CreateFromUserRoles(
83 const std::vector<UserRoles>& usersAndRoles);
84
92 MIP_API static std::shared_ptr<ProtectionDescriptorBuilder> CreateFromTemplate(const std::string& templateId);
93
101 MIP_API static std::shared_ptr<ProtectionDescriptorBuilder> CreateFromSerializedTemplate(
102 const std::vector<uint8_t>& serializedTemplate);
103
111 MIP_API static std::shared_ptr<ProtectionDescriptorBuilder> CreateFromProtectionDescriptor(const ProtectionDescriptor& protectionDescriptor);
112
122 MIP_API static std::shared_ptr<ProtectionDescriptorBuilder> CreateFromLicenseType(
123 LicenseType licenseType,
124 const std::vector<std::string>& usersWithDefaultRights,
125 const std::vector<UserRights>& additionalUsersAndRights);
126
132 MIP_API virtual std::shared_ptr<ProtectionDescriptor> Build() = 0;
133
139 virtual void SetName(const std::string& value) = 0;
140
146 virtual void SetDescription(const std::string& value) = 0;
147
153 virtual void SetContentValidUntil(const std::chrono::time_point<std::chrono::system_clock>& value) = 0;
154
160 virtual void SetAllowOfflineAccess(bool value) = 0;
161
170 virtual void SetReferrer(const std::string& uri) = 0;
171
180 virtual void SetEncryptedAppData(const std::map<std::string, std::string>& value) = 0;
181
190 virtual void SetSignedAppData(const std::map<std::string, std::string>& value) = 0;
191
197 virtual void SetDoubleKeyUrl(const std::string& doubleKeyUrl) = 0;
198
204 virtual void SetLabelInfo(const LabelInfo& labelId) = 0;
205
208protected:
211};
212
213MIP_NAMESPACE_END
214
215#endif //API_MIP_PROTECTION_DESCRIPTOR_BUILDER_H_
Constructs a ProtectionDescriptor that describes protection associated with a piece of content.
Definition protection_descriptor_builder.h:49
virtual void SetSignedAppData(const std::map< std::string, std::string > &value)=0
Sets app-specific data that should be signed.
static MIP_API std::shared_ptr< ProtectionDescriptorBuilder > CreateFromTemplate(const std::string &templateId)
Creates a ProtectionDescriptorBuilder whose access permissions are defined by the protection template...
virtual void SetReferrer(const std::string &uri)=0
Sets protection policy referrer address.
static MIP_API std::shared_ptr< ProtectionDescriptorBuilder > CreateFromUserRoles(const std::vector< UserRoles > &usersAndRoles)
Creates a ProtectionDescriptorBuilder whose access permissions are defined by users and roles.
virtual void SetDoubleKeyUrl(const std::string &doubleKeyUrl)=0
Sets the double key url to be used for custom protection.
virtual void SetEncryptedAppData(const std::map< std::string, std::string > &value)=0
Sets app-specific data that should be encrypted.
virtual void SetName(const std::string &value)=0
Sets protection policy name.
LicenseType
License type to create a specialized license.
Definition protection_descriptor_builder.h:54
@ EncryptOnly
Defines an encrypt only license type.
@ DoNotForward
Defines a do not forward license type.
static MIP_API std::shared_ptr< ProtectionDescriptorBuilder > CreateFromLicenseType(LicenseType licenseType, const std::vector< std::string > &usersWithDefaultRights, const std::vector< UserRights > &additionalUsersAndRights)
Creates a ProtectionDescriptorBuilder for a license type with the specified users.
static MIP_API std::shared_ptr< ProtectionDescriptorBuilder > CreateFromSerializedTemplate(const std::vector< uint8_t > &serializedTemplate)
Creates a ProtectionDescriptorBuilder whose access permissions are defined by the protection template...
virtual void SetContentValidUntil(const std::chrono::time_point< std::chrono::system_clock > &value)=0
Sets protection policy expiration time.
virtual void SetLabelInfo(const LabelInfo &labelId)=0
Sets the label id and tenant id for UDP protection. Only allowed for custom protection type.
virtual MIP_API std::shared_ptr< ProtectionDescriptor > Build()=0
Creates a ProtectionDescriptor whose access permissions are defined by this ProtectionDescriptorBuild...
virtual void SetAllowOfflineAccess(bool value)=0
Sets if protection policy allows offline content access or not.
static MIP_API std::shared_ptr< ProtectionDescriptorBuilder > CreateFromUserRights(const std::vector< UserRights > &usersAndRights)
Creates a ProtectionDescriptorBuilder whose access permissions are defined by users and rights.
static MIP_API std::shared_ptr< ProtectionDescriptorBuilder > CreateFromProtectionDescriptor(const ProtectionDescriptor &protectionDescriptor)
Creates a ProtectionDescriptorBuilder whose access permissions are defined by a protection descriptor...
virtual void SetDescription(const std::string &value)=0
Sets protection policy description.
Description of protection associated with a piece of content.
Definition protection_descriptor.h:72
A file export/import macros.
MIP namespace macros.
Defines ProtectionDescriptor interface.
Label information for a template or ad-hoc (custom) protection.
Definition protection_descriptor.h:60
Defines UserRights class.
Defines UserRoles class.