33#ifndef API_MIP_COMMON_TYPES_H_
34#define API_MIP_COMMON_TYPES_H_
41#include <unordered_map>
48#define UNUSED(x) (void)x
101 static const std::string fileContentFormat =
"file";
102 return fileContentFormat;
106 static const std::string emailContentFormat =
"email";
107 return emailContentFormat;
178enum class ContainerDecryptionOption :
unsigned int {
191inline std::string ContainerDecryptionOptionString(ContainerDecryptionOption option) {
192 static std::string kMethodArray[] = {
"default",
"msg",
"top",
"all" };
193 return kMethodArray[
static_cast<int>(option)];
229 static std::string kMethodArray[] = {
"Standard",
"Privileged",
"Auto" };
230 return kMethodArray[
static_cast<int>(method)];
240 static std::string kMethodArray[] = {
"Manual",
"Automatic",
"Recommended",
"Default" };
241 return kMethodArray[
static_cast<int>(actionSource)];
251 static std::string kMethodArray[] = {
"Rest",
"Motion",
"Use" };
252 return kMethodArray[
static_cast<int>(state)];
257 static const std::string sqliteExtension =
".sqlite3";
258 return sqliteExtension;
263 static const std::string memoryPath =
":memory:";
282 : mEmail(other.mEmail),
283 mName(other.mName) { }
290 explicit Identity(
const std::string& email) : mEmail(email) { }
298 explicit Identity(
const std::string& email,
const std::string& name) : mEmail(email), mName(name) { }
305 const std::string&
GetEmail()
const {
return mEmail; }
312 const std::string&
GetName()
const {
return mName; }
338 const std::string& authority,
339 const std::string& resource,
340 const std::string& scope = std::string(),
341 const std::string& claims = std::string())
342 : mAuthority(authority),
364 const std::string&
GetScope()
const {
return mScope; }
370 const std::string&
GetClaims()
const {
return mClaims; }
372 std::string mAuthority;
373 std::string mResource;
393 OAuth2Token(
const std::string& accessToken) : mAccessToken(accessToken) {}
407 void SetAccessToken(
const std::string& accessToken) { mAccessToken = accessToken; }
421 void SetErrorMessage(
const std::string& errorMessage) { mErrorMessage = errorMessage; }
424 std::string mAccessToken;
425 std::string mErrorMessage;
447 OAuth2Token& token) { UNUSED(identity); UNUSED(challenge); UNUSED(token);
return false; }
466 const std::shared_ptr<void>& context,
535 return "policy_data";
543 return "export_policy_file";
551 return "sensitivity_types_data";
559 return "policy_file";
567 return "sensitivity_types_file";
575 return "label_custom_properties_sync_enabled";
584 return "PolicyTtlDays";
593 return "SensitivityPolicyTtlDays";
602inline constexpr const char* GetEnforceMsgPfileProtection() {
603 return "EnforceMsgPfileProtection";
610inline constexpr const char* GetCustomSettingEnableMsgFileType() {
611 return "enable_msg_file_type";
618inline constexpr const char* GetCustomSettingContainerDecryptionOption() {
619 return "container_decryption_option";
625inline constexpr const char* GetCustomSettingEnablePowerBIFileType() {
626 return "enable_power_bi_file_type";
632inline constexpr const char* GetCustomSettingKeepPdfLinearization() {
633 return "keep_pdf_linearization";
635inline constexpr const char* GetCustomSettingEnableDeprecatedRemoveActions() {
636 return "enable_deprecated_remove_actions";
638inline constexpr const char* GetCustomSettingPrintDiscoveredInfoTypesToTrace() {
639 return "LogMatchedContentToTrace";
641inline constexpr const char* GetCustomSettingTaskTimeoutMs() {
642 return "TaskTimeoutMs";
645inline constexpr const char* GetCustomSettingLabelWithoutPolicy() {
646 return "label_without_policy";
649inline constexpr const char* GetCustomSettingMaxFileSizeForProtection() {
650 return "max_file_size_for_protection";
653inline constexpr const char* GetCustomSettingMaxNestedProtectedMsgs() {
654 return "max_nested_protected_msgs";
657inline constexpr const char* GetCustomSettingMaxPolicyXmlVersion() {
658 return "max_policy_xml_version";
666inline constexpr const char* GetCustomSettingDelegateApplicationInfo() {
667 return "delegate_application_info";
676inline constexpr const char* GetCustomSettingEnableCoAuthMetadata() {
677 return "co_auth_metadata";
685inline constexpr const char* GetCustomSettingLabelsForAllContentFormats() {
686 return "labels_for_all_content_formats";
692class CaseInsensitiveComparator {
694 bool operator() (
const std::string& lhs,
const std::string& rhs)
const {
695 if (lhs.size() != rhs.size())
696 return lhs.size() < rhs.size();
699 return _strnicmp(lhs.c_str(), rhs.c_str(), lhs.size()) < 0;
701 return strncasecmp(lhs.c_str(), rhs.c_str(), lhs.size()) < 0;
Class used to cancel async operation.
virtual bool Cancel()=0
Calling cancel will result in a attempt to cancel the task, in case of success the appropriate onFail...
a class that contains all the information required from the calling application in order to generate ...
const std::string & GetScope() const
Get the scope string.
const std::string & GetResource() const
Get the resource string.
const std::string & GetClaims() const
Get the claims string.
OAuth2Challenge(const std::string &authority, const std::string &resource, const std::string &scope=std::string(), const std::string &claims=std::string())
Construct a new OAuth2Challenge object.
const std::string & GetAuthority() const
Get the authority string.
A class containing access token info provided by an application.
void SetAccessToken(const std::string &accessToken)
Set the access token string.
OAuth2Token(const std::string &accessToken)
Construct a new OAuth2Token object from JWT access token.
OAuth2Token()
Construct a new OAuth2Token object.
void SetErrorMessage(const std::string &errorMessage)
Set the error message.
const std::string & GetAccessToken() const
Get the access token string.
const std::string & GetErrorMessage() const
Get the error message, if any.
Delegate for auth related operations.
virtual bool AcquireOAuth2Token(const Identity &identity, const OAuth2Challenge &challenge, const std::shared_ptr< void > &context, OAuth2Token &token)
This method is called when an auth token is required for the policy engine with the given identity an...
virtual bool AcquireOAuth2Token(const Identity &identity, const OAuth2Challenge &challenge, OAuth2Token &token)
This method is called when an auth token is required for the policy engine with the given identity an...
Delegate for consent related operations.
virtual Consent GetUserConsent(const std::string &url)=0
Called when SDK requires user consent to connect to a service endpoint.
Abstraction for identity.
Identity(const std::string &email, const std::string &name)
Identity constructor used when a user email address and user name is known.
Identity()
Default Identity constructor used when a user email address is not known.
const std::string & GetEmail() const
Get the email.
Identity(const Identity &other)
Identity copy constructor.
const std::string & GetName() const
Get the user's friendly name. used for text marking.
Identity(const std::string &email)
Identity constructor used when a user email address is known.
const std::string & GetSqliteExtension()
constexpr const char * GetCustomSettingSensitivityTypesDataName()
Name of the setting to explicitly specify sensitivity data.
FeatureId
Defines new features by name.
PFileExtensionBehavior
Describes PFile extensions behavior.
Cloud
Azure cloud identifier.
AssignmentMethod
The assignment method of the label on the document. Whether the Assignment of the label was done auto...
CacheStorageType
Storage type for the caches.
constexpr const char * GetCustomSettingPolicyDataName()
Name of the setting to explicitly specify policy data.
FunctionalityFilterType operator&(FunctionalityFilterType firstFilter, FunctionalityFilterType secondFilter)
constexpr const char * GetCustomSettingSensitivityPolicyTtlDays()
Name of the setting that enables overriding sensitivity policy ttl in days be default it will be 30 d...
const std::string & GetFileContentFormat()
FunctionalityFilterType operator|(FunctionalityFilterType firstFilter, FunctionalityFilterType secondFilter)
VariableTextMarkingType
various dynamic fields can be set into the text message of the application Some known: ${Item....
DataState
Defines what state of the data is the application acting upon.
ContentMarkAlignment
Alignment for content marks (content header or content footer).
Consent
A user's response when consent is requested to connect to a service endpoint.
FunctionalityFilterType operator~(FunctionalityFilterType filter)
const std::string & GetMemoryDatabasePath()
Workload
The workload the application is working on, used primary to check for consent.
static std::string GetDataStateString(DataState state)
Get the content state name.
LabelFilterType
Label filter types, optional set of properties that can be used to filter labels or label behavior wh...
@ DoubleKeyUserDefinedProtection
@ MachineLearningClassifier
@ ExtendedSensitiveInformationClassifier
@ SensitiveInformationClassifier
@ PredefinedTemplateProtection
constexpr const char * GetCustomSettingPolicyDataFile()
Name of the setting to explicitly specify policy data file path.
static std::string GetActionSourceString(ActionSource actionSource)
Get the action source name.
Classifier
The type of classification the application should be running on the data to determine autolabeling st...
@ ExtendedSensitiveInformation
constexpr const char * GetCustomSettingPolicyTtlDays()
Name of the setting that enables overriding policy ttl in days be default it will be 30 days....
constexpr const char * GetCustomSettingSensitivityTypesDataFile()
Name of the setting to explicitly specify sensitivity types data file path.
DataBoundary
Diagnostic region identifier.
@ Europe_MiddleEast_Africa
std::string GetAssignmentMethodString(AssignmentMethod method)
Converts AssignmentMethod enum to a string description.
std::map< mip::Classifier, UniqueIdsAndContentFormats > ClassifierUniqueIdsAndContentFormats
ActionSource
defines what triggered the SetLabel event
WatermarkLayout
Layout for watermarks.
LabelFilterType FunctionalityFilterType
Name change within the cpp workspace to imply the filters has greater scope than just label behavior....
constexpr const char * GetCustomSettingLabelCustomPropertiesSyncEnabled()
Name of the setting that allows to enable label by custom properties and custom properties by label f...
const std::string & GetEmailContentFormat()
constexpr const char * GetCustomSettingExportPolicyFileName()
Name of the setting to explicitly specify file path to export SCC policy data to.
A struct that includes application specific information.
std::string applicationName
std::string applicationVersion
std::string applicationId
std::unordered_map< std::string, std::string > uniqueIds
std::vector< std::string > contentFormats