33#ifndef API_MIP_UPE_POLICY_ENGINE_H_
34#define API_MIP_UPE_POLICY_ENGINE_H_
77 const std::string& engineId,
78 const std::shared_ptr<AuthDelegate>& authDelegate,
79 const std::string& clientData,
80 const std::string& locale =
"",
81 bool loadSensitivityTypes =
false)
82 : mEngineId(engineId),
83 mAuthDelegate(authDelegate),
84 mClientData(clientData),
86 mIsLoadSensitivityTypesEnabled(loadSensitivityTypes) {
87 if (mLocale.compare(
"") == 0) {
107 const std::shared_ptr<AuthDelegate>& authDelegate,
108 const std::string& clientData,
109 const std::string& locale =
"",
110 bool loadSensitivityTypes =
false)
111 : mIdentity(identity),
112 mAuthDelegate(authDelegate),
113 mClientData(clientData),
115 mIsLoadSensitivityTypesEnabled(loadSensitivityTypes) {
116 if (mLocale.compare(
"") == 0) {
163 void SetClientData(
const std::string& clientData) { mClientData = clientData; }
170 const std::string&
GetLocale()
const {
return mLocale; }
177 void SetCustomSettings(
const std::vector<std::pair<std::string, std::string>>& customSettings) {
178 mCustomSettings = customSettings;
187 return mCustomSettings;
197 mSessionId = sessionId;
215 return mIsLoadSensitivityTypesEnabled;
246 mDataBoundary = dataBoundary;
255 return mDataBoundary;
266 mCloudEndpointBaseUrl = cloudEndpointBaseUrl;
275 return mCloudEndpointBaseUrl;
304#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
305 [[deprecated(
"SetLabelFilter is deprecated, use ConfigureFunctionality")]]
307 void SetLabelFilter(
const std::vector<LabelFilterType>& deprecatedLabelFilters) {
308 mDeprecatedLabelFilters = deprecatedLabelFilters;
317 const std::vector<LabelFilterType>&
GetLabelFilter()
const {
return mDeprecatedLabelFilters; }
330 "FunctionalityFilterType::None is not supported");
333 mConfiguredFunctionality[functionalityFilterType] = enabled;
350 mVariableTextMarkingType = variableTextMarkingType;
360 return mVariableTextMarkingType;
369 mAuthDelegate = authDelegate;
379#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
394 mLoggerContext = loggerContext;
400 std::string mEngineId;
404 std::shared_ptr<AuthDelegate> mAuthDelegate;
405 std::string mClientData;
406 std::vector<std::pair<std::string, std::string>> mCustomSettings;
407 std::vector<LabelFilterType> mDeprecatedLabelFilters;
408 std::map<FunctionalityFilterType, bool> mConfiguredFunctionality;
410 std::string mSessionId;
411 bool mIsLoadSensitivityTypesEnabled;
412 std::string mCloudEndpointBaseUrl;
413 std::string mDelegatedUserEmail;
415 std::map<Classifier, bool> mClassifierSupport;
416 std::shared_ptr<void> mLoggerContext;
437 const std::vector<std::string>& contentFormats = std::vector<std::string>()) = 0;
487 virtual std::shared_ptr<Label>
GetLabelById(
const std::string&
id)
const = 0;
498 virtual std::shared_ptr<PolicyHandler>
CreatePolicyHandler(
bool isAuditDiscoveryEnabled,
bool isGetSensitivityLabelAuditDiscoveryEnabled =
true) = 0;
508 const std::string& level,
509 const std::string& eventType,
510 const std::string& eventData) = 0;
563 virtual bool HasClassificationRules(
const std::vector<std::string>& contentFormats = std::vector<std::string>())
const = 0;
A file containing the Action base class and the ActionType enumerator.
Abstraction for identity.
Defines the settings associated with a PolicyEngine.
void SetCustomSettings(const std::vector< std::pair< std::string, std::string > > &customSettings)
Set the custom settings, used for feature gating and testing.
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 ...
Cloud GetCloud() const
Gets the target cloud used by all service requests.
const std::map< FunctionalityFilterType, bool > & GetConfiguredFunctionality() const
Gets the configured functionality.
const std::string & GetClientData() const
Get the Client Data set in the settings.
void SetDataBoundary(DataBoundary dataBoundary)
Optionally sets the target diagnostic region.
const std::vector< std::pair< std::string, std::string > > & GetCustomSettings() const
Get the custom settings, used for feature gating and testing.
void SetSessionId(const std::string &sessionId)
Set the session ID, used for client defined telemetry and to make it easier to correlate application ...
void SetLabelFilter(const std::vector< LabelFilterType > &deprecatedLabelFilters)
Sets the label filter.
void SetIdentity(const Identity &identity)
Set the Identity object.
const std::string & GetEngineId() const
Get the engine ID.
const std::string & GetLocale() const
Get the Locale set in the settings.
const std::vector< LabelFilterType > & GetLabelFilter() const
Gets the label filters set through deprecated function SetLabelFilter.
const Identity & GetIdentity() const
Get the Identity object.
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 SetDelegatedUserEmail(const std::string &delegatedUserEmail)
Sets the delegated user.
bool IsLoadSensitivityTypesEnabled() const
Get the the flag indicating if load sensitivity labels is enabled.
Settings(const Identity &identity, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="", bool loadSensitivityTypes=false)
PolicyEngine::Settings constructor for creating a new engine.
DataBoundary GetDataBoundary() const
Gets the data boundary region.
VariableTextMarkingType GetVariableTextMarkingType() const
Gets the variable text marking type.
const std::string & GetSessionId() const
Get the session ID, a unique identifier.
void SetEngineId(const std::string &id)
Set the engine ID.
const std::string & GetCloudEndpointBaseUrl() const
Gets the cloud base URL used by all service requests, if specified.
std::shared_ptr< AuthDelegate > GetAuthDelegate() const
Get the Engine Auth Delegate.
void SetVariableTextMarkingType(VariableTextMarkingType variableTextMarkingType)
Sets the variable text marking type.
const std::string & GetDelegatedUserEmail() const
Gets the delegated user.
void SetCloud(Cloud cloud)
Optionally sets the target cloud.
void SetAuthDelegate(const std::shared_ptr< AuthDelegate > &authDelegate)
Set the Engine Auth Delegate.
void ConfigureFunctionality(FunctionalityFilterType functionalityFilterType, bool enabled)
Enables or disables functionality.
void SetCloudEndpointBaseUrl(const std::string &cloudEndpointBaseUrl)
Sets the cloud endpoint base URL for custom cloud.
void SetClientData(const std::string &clientData)
Set the Client Data string.
Settings(const std::string &engineId, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="", bool loadSensitivityTypes=false)
PolicyEngine::Settings constructor for loading an existing engine.
This class provides an interface for all engine functions.
virtual const std::string & GetSensitivityFileId() const =0
Gets the sensitivity file ID.
virtual std::chrono::time_point< std::chrono::system_clock > GetLastPolicyFetchTime() const =0
Gets the time when the policy was last fetched.
virtual bool HasClassificationRules(const std::vector< std::string > &contentFormats=std::vector< std::string >()) const =0
Gets if the policy has automatic or recommendation rules according to the provided contentFormats.
virtual const std::string & GetMoreInfoUrl() const =0
Provide a url for looking up more information about the policy/labels.
virtual const std::string & GetTenantId() const =0
Gets tenant ID associated with engine.
virtual bool HasWorkloadConsent(Workload workload) const =0
Checks if user has consented to specific workload,.
virtual const std::vector< std::pair< std::string, std::string > > & GetCustomSettings() const =0
Gets a list of custom settings.
virtual std::shared_ptr< PolicyHandler > CreatePolicyHandler(bool isAuditDiscoveryEnabled, bool isGetSensitivityLabelAuditDiscoveryEnabled=true)=0
Create a Policy Handler to execute policy-related functions on a file's execution state.
virtual bool IsDowngradeJustificationRequired() const =0
Checks if the policy dictates that given a label sensitivity level downgrade requires a justification...
virtual const std::shared_ptr< Label > GetDefaultSensitivityLabel(const std::string &contentFormat=std::string()) const =0
Get the default sensitivity label according to the provided contentFormat.
virtual bool IsLabelingRequired(const std::string &contentFormat=std::string()) const =0
Checks if the policy dictates that a content must be labeled or not according to the provided content...
virtual void SendApplicationAuditEvent(const std::string &level, const std::string &eventType, const std::string &eventData)=0
Logs an application specific event to the audit pipeline.
virtual const std::string & GetPolicyDataXml() const =0
Gets policy data XML which describes the settings, labels, and rules associated with this policy.
virtual const std::vector< std::shared_ptr< SensitivityTypesRulePackage > > & ListSensitivityTypes() const =0
list the sensitivity types associated with the policy engine.
virtual std::shared_ptr< Label > GetLabelById(const std::string &id) const =0
Gets the label according to the provided id.
virtual const std::vector< std::shared_ptr< Label > > ListSensitivityLabels(const std::vector< std::string > &contentFormats=std::vector< std::string >())=0
list the sensitivity labels associated with the policy engine according to the provided contentFormat...
virtual const std::string & GetSensitivityTypesDataXml() const =0
Gets sensitivity types data XML which describes the sensitivity types associated with this policy.
virtual const std::string & GetPolicyFileId() const =0
Gets the policy file ID.
virtual uint32_t GetWxpMetadataVersion() const =0
Gets the recommended WXP (Word, Excel, Powerpoint) metadata version, currently 0 for old verion 1 for...
virtual const Settings & GetSettings() const =0
Get the policy engine Settings.
A file Containing the common types used by the upe, file and protection modules.
Cloud
Azure cloud identifier.
@ Unknown
Cloud not specified or URL not recognized as an Azure cloud.
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.
Workload
The workload the application is working on, used primary to check for consent.
LabelFilterType
Label filter types, optional set of properties that can be used to filter labels or label behavior wh...
@ None
Disable default labeling filtration.
DataBoundary
Diagnostic region identifier.
@ Default
Region is not specified.
A file Containing the ContentLabel class.
A file containing the MIP SDK error types.
This file contains the ExecutionState class.
This file contains the Label class.
This file contains the PolicyHandler class.