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* GetCustomSettingMaxPolicyXmlVersion() {
654 return "max_policy_xml_version";
662inline constexpr const char* GetCustomSettingDelegateApplicationInfo() {
663 return "delegate_application_info";
672inline constexpr const char* GetCustomSettingEnableCoAuthMetadata() {
673 return "co_auth_metadata";
681inline constexpr const char* GetCustomSettingLabelsForAllContentFormats() {
682 return "labels_for_all_content_formats";
688class CaseInsensitiveComparator {
690 bool operator() (
const std::string& lhs,
const std::string& rhs)
const {
691 if (lhs.size() != rhs.size())
692 return lhs.size() < rhs.size();
695 return _strnicmp(lhs.c_str(), rhs.c_str(), lhs.size()) < 0;
697 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.
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.
@ EncryptOnly
Check if server supports EncryptOnly feature.
PFileExtensionBehavior
Describes PFile extensions behavior.
@ PPrefix
Extensions will become P<EXT>
@ PFileSuffix
Extensions will become <EXT>.PFILE.
Cloud
Azure cloud identifier.
@ US_GCC_High
US sovereign cloud (GCC-High)
@ US_Sec
US sovereign cloud (Sec)
@ US_GCC
US sovereign cloud (GCC)
@ US_Nat
US sovereign cloud (Nat)
@ China_01
China sovereign cloud.
@ Unknown
Cloud not specified or URL not recognized as an Azure cloud.
@ US_DoD
US sovereign cloud (DoD)
@ Custom
Custom cloud: endpoint base URL manually specified by application.
@ Commercial
Global commercial cloud.
@ Germany
Germany sovereign cloud.
AssignmentMethod
The assignment method of the label on the document.
@ STANDARD
Label assignment method is standard.
@ PRIVILEGED
Label assignment method is privileged.
@ AUTO
Label assignment method is automatic.
CacheStorageType
Storage type for the caches.
@ InMemory
In Memory storage.
@ OnDiskEncrypted
On Disk storage with internal encryption (if supported by the platform)
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....
@ Default
Known markings are converted unknown marking are removed.
@ PassThrough
Known markings are converted unknown marking are passed through.
DataState
Defines what state of the data is the application acting upon.
@ REST
Inactive data stored physically in databases/file/warehouses.
@ USE
Active data under constant change stored physically in databases/file/warehouses etc.
@ MOTION
Data traversing a network or temporarily residing in computer memory to be read or updated.
ContentMarkAlignment
Alignment for content marks (content header or content footer).
@ RIGHT
Content marking is aligned to the right.
@ LEFT
Content marking is aligned to the left.
@ CENTER
Content marking is centered.
Consent
A user's response when consent is requested to connect to a service endpoint.
@ AcceptAlways
Consent, and remember this decision.
@ Accept
Consent, just one time.
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
Filter labels that may result in protection that requires double key adhoc and dnf.
@ CustomProtection
Filter labels that may result in custom protection.
@ TemplateProtection
Filter labels that may result in template protection.
@ EncryptOnlyProtection
Filter labels that may result in encrypt only.
@ DoNotForwardProtection
Filter labels that may result in do not forward.
@ HyokProtection
Filter labels that may result in hyok protection.
@ MachineLearningClassifier
Classifier based on Machine Learning (e.g.
@ AdhocProtection
Filter labels that may result in adhoc protection.
@ None
Disable default labeling filtration.
@ DoubleKeyProtection
Filter labels that may result in protection that requires double key, can be template,...
@ ExtendedSensitiveInformationClassifier
Classifier based on Sensitive Information Detection (e.g.
@ SensitiveInformationClassifier
Classifier based on Sensitive Information Detection (e.g.
@ PredefinedTemplateProtection
Filter labels that may result in predefined template protection.
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.
@ European_Union
European Union region.
@ North_America
North America region.
@ Europe_MiddleEast_Africa
Europe, Middle East & Africa region.
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
@ AUTOMATIC
Set by policy conditions.
@ RECOMMENDED
Set by user after label was recommended by policy conditions.
@ DEFAULT
Set by default in policy.
@ MANUAL
Selected manually by user.
WatermarkLayout
Layout for watermarks.
@ HORIZONTAL
Watermark layout is horizontal.
@ DIAGONAL
Watermark layout is diagonal.
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.
@ All
Any and all Pii is represented.
@ Msg
Msg style file inspector, rpmsg / msg based.
A struct that includes application specific information.
std::string applicationName
Application name, (Should only contain valid ASCII character excluding ';')
std::string applicationVersion
The version of the application being used, (Should only contain valid ASCII character excluding ';')
std::string applicationId
Application identifier as set in the AAD portal, (Should be a GUID without brackets).
std::unordered_map< std::string, std::string > uniqueIds
std::vector< std::string > contentFormats