FAQ/windows-active-directory-security.md
... ...
@@ -1,15 +1,19 @@
1
-#Support Active Directory/Windows Authentication
1
+#Active Directory/Windows Authentication
2 2
3 3
[[_TOC_]]
4 4
5
-##Windows Authentication
5
+##Question
6
+
7
+##Answer
8
+
9
+###Windows Authentication
6 10
7 11
In some cases, it is preferable to use a custom authentication system to store all authentication data, user lists, credentials, etc.
8 12
But sometimes it will be much easier to use built-in system authentication features that you are already leveraging instead of creating something new. ASP.NET can handle the authentication processes and all that is required is to apply needed roles/permissions/security rules for the user as described in our [[Security Guide|Integration/Tutorials/Security]].
9 13
10 14
Follow these steps to set up Windows Authentication with Impersonation for the AdHoc application:
11 15
12
-##Open the Authentication settings for the website
16
+###Open the Authentication settings for the website
13 17
14 18
* Open IIS Manager
15 19
* Expand the "Sites" tree and find your website
... ...
@@ -18,7 +22,7 @@ Follow these steps to set up Windows Authentication with Impersonation for the A
18 22
![Open Authentication settings](http://izenda.com/Site/KB/KB/Uploads/Images/IIS_auth.png)
19 23
20 24
21
-##Configure Authentication settings
25
+###Configure Authentication settings
22 26
23 27
* Disable Anonymous Authentication
24 28
* Enable ASP.NET Impersonation
... ...
@@ -34,7 +38,7 @@ Or you can also set these settings manually in the web.config file at the root f
34 38
```
35 39
36 40
37
-##Use authentication information in the AdHoc security model
41
+###Use authentication information in the AdHoc security model
38 42
39 43
Place the following lines of code into your ``global.asax``.
40 44
... ...
@@ -65,4 +69,30 @@ Public Shared Sub InitializeReporting()
65 69
AdHocSettings.CurrentUserName = user.Name
66 70
AdHocSettings.CurrentUserIsAdmin = New WindowsPrincipal(user).IsInRole(WindowsBuiltInRole.Administrator)
67 71
End Sub
72
+```
73
+
74
+###Authenticating Over OData
75
+
76
+The process for authenticating a user over an OData connection is slightly different in the code that must be implemented to enable this. A sample is shown below.
77
+
78
+```csharp
79
+public class CustomAdHocConfig : FileSystemAdHocConfig {
80
+ public static void InitializeReporting() {
81
+ FusionDriver fd = new FusionDriver();
82
+ fd.AddCustomConnection(new CustomODataConnection("SecureConnection", "http://www.yoursite.com/odataprovider.aspx"));
83
+ }
84
+}
85
+
86
+public class CustomODataConnection : ODataFusionConnection
87
+{
88
+ public CustomODataConnection(string alias, string getSchemaUrl) : base(alias, getSchemaUrl) { }
89
+
90
+ public override void ProcessPostRequest(System.Net.HttpWebRequest request)
91
+ {
92
+ System.Net.NetworkCredential cred = new System.Net.NetworkCredential();
93
+ cred.UserName = WindowsIdentity.GetCurrent().Name;
94
+ cred.Password = HttpContext.Current.Session["Password"].ToString(); //This could be passed from a text field the user is prompted for or from custom storage code in your login process.
95
+ request.Credentials = cred;
96
+ }
97
+}
68 98
```
... ...
\ No newline at end of file