aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Web/Helpers
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-24 14:46:55 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-24 14:46:55 +0200
commit0fb83fb3abb456ee6707b7f3cabc6b0c1ab2281b (patch)
tree6b0076b6c1daacd51c2aab18aaaf15e6edb19d9e /Software/Visual_Studio/Tango.Web/Helpers
parent2f77ad3cebf771bdf02188174c9712027b004d41 (diff)
downloadTango-0fb83fb3abb456ee6707b7f3cabc6b0c1ab2281b.tar.gz
Tango-0fb83fb3abb456ee6707b7f3cabc6b0c1ab2281b.zip
Moved all common web components to Tango.Web
Changed app keys names. Fixed issue with machine studio and the initialization of observables static collections.
Diffstat (limited to 'Software/Visual_Studio/Tango.Web/Helpers')
-rw-r--r--Software/Visual_Studio/Tango.Web/Helpers/AzureDirectoryHelper.cs19
-rw-r--r--Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs26
2 files changed, 45 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Web/Helpers/AzureDirectoryHelper.cs b/Software/Visual_Studio/Tango.Web/Helpers/AzureDirectoryHelper.cs
new file mode 100644
index 000000000..27b5e7cf5
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Web/Helpers/AzureDirectoryHelper.cs
@@ -0,0 +1,19 @@
+using Microsoft.IdentityModel.Clients.ActiveDirectory;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace Tango.Web.Helpers
+{
+ public static class AzureDirectoryHelper
+ {
+ public static AuthenticationResult AuthenticateUser(String email, String password)
+ {
+ var authContext = new AuthenticationContext("https://login.microsoftonline.com/2ebd63a5-bc2f-41dc-9066-4409ed5e5dd4");
+ UserCredential userCredential = new UserCredential(email, password);
+ AuthenticationResult authResult = authContext.AcquireToken("https://graph.windows.net/", "ec612854-7abc-457b-808a-5d0c5ba80c57", userCredential);
+ return authResult;
+ }
+ }
+} \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs b/Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs
new file mode 100644
index 000000000..fcf6eb599
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Web/Helpers/ObservablesContextHelper.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
+using System.Web;
+using Tango.BL;
+using Tango.Core;
+
+namespace Tango.Web.Helpers
+{
+ public static class ObservablesContextHelper
+ {
+ public static ObservablesContext CreateContext()
+ {
+ return new ObservablesContext(new DataSource()
+ {
+ Address = WebConfig.DB_ADDRESS,
+ Catalog = WebConfig.DB_CATALOG,
+ IntegratedSecurity = false,
+ Type = DataSourceType.SQLServer,
+ UserName = WebConfig.DB_USER_NAME,
+ Password = WebConfig.DB_PASSWORD
+ });
+ }
+ }
+} \ No newline at end of file