row.Set_author_name(widgetConfigurationInfo.authorName);
row.Set_author_email(widgetConfigurationInfo.authorEmail);
row.Set_author_href(widgetConfigurationInfo.authorHref);
+ row.Set_csp_policy(widgetConfigurationInfo.cspPolicy);
row.Set_base_folder(DPL::FromUTF8String(regInfo.baseFolder));
row.Set_webkit_plugins_required(widgetConfigurationInfo.flashNeeded);
row.Set_recognized(wacSecurity.isRecognized());
}
}
+DPL::OptionalString WidgetDAOReadOnly::getCspPolicy() const
+{
+ WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
+ return row.Get_csp_policy();
+}
+
bool WidgetDAOReadOnly::getWebkitPluginsRequired() const
{
WidgetInfoRow row = getWidgetInfoRow(m_widgetHandle);
DPL::OptionalString tizenPkgId;
DPL::OptionalString tizenAppId;
+ //csp polic for widget
+ DPL::OptionalString cspPolicy;
+
//Application service model list
ServiceInfoList appServiceList; //It will be removed.
AppControlInfoList appControlList;
/**
* Returns tizenAppId for the specified widget
*
- * @return tzAppid;
+ * @return tzAppid;
* @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
* @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in DB table.
*/
/**
* Returns WidgetPkgName for the specified widget
*
- * @return pkgName;
+ * @return pkgName;
* @exception WRT_CONF_ERR_EMDB_FAILURE - Fail to query DB table.
* @exception WRT_CONF_ERR_EMDB_NO_RECORD - Can not find matching records in DB table.
*/
DPL::OptionalString getVersion() const;
/**
+ * This method is used as a getter for csp policy of widget. It should be
+ * provided in configuration file.
+ * @return global csp policy for widget
+ */
+ DPL::OptionalString getCspPolicy() const;
+
+ /**
* This method returns list filed with Common Name entries from certificate.
*
* @return Common Name of Distribuotor End Entity certificate.
COLUMN(base_folder, VARCHAR(256), DEFAULT '')
COLUMN(webkit_plugins_required, TINYINT, DEFAULT 0)
COLUMN(security_domain, INT, DEFAULT 0)
+ COLUMN(csp_policy, TEXT, DEFAULT '')
COLUMN(recognized, INT, DEFAULT 0)
COLUMN(wac_signed, INT, DEFAULT 0)
COLUMN(distributor_signed, INT, DEFAULT 0)
}
}
+/*
+Name: widget_dao_test_register_scp
+Description: Tests inserting and returning scp policy information
+Expected: Value inserted into database should match values received from database
+*/
+RUNNER_TEST(widget_dao_test_register_scp)
+{
+ WacSecurityMock sec;
+ WidgetRegisterInfo regInfo;
+ DPL::OptionalString policy = DPL::FromUTF8String("Some awesome csp policy");
+ regInfo.configInfo.cspPolicy = policy;
+ {
+ // register widget
+ TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
+ WidgetDAO dao(tizenAppId);
+
+ RUNNER_ASSERT_WHAT_EQUALS_OPTIONAL(dao.getCspPolicy(), DPL::ToUTF8String(*policy));
+ }
+}
+
+/*
+Name: widget_dao_test_register_csp_empty
+Description: Tests inserting and returning empty csp policy
+Expected: Value inserted into database should match values received from database
+*/
+RUNNER_TEST(widget_dao_test_register_csp_empty)
+{
+ WacSecurityMock sec;
+ WidgetRegisterInfo regInfo;
+ {
+ // register widget
+ TizenAppId tizenAppId = REGISTER_WIDGET(regInfo, sec);
+ WidgetDAO dao(tizenAppId);
+
+ RUNNER_ASSERT_MSG(dao.getCspPolicy().IsNull(), "Policy is not null");
+ }
+}
#undef RUNNER_ASSERT_WHAT_EQUALS