f4d13ffd2ed5a13cb4261415b4a42cdb82993c4e
FAQ/windows-active-directory-security.md
| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | +#Support Active Directory/Windows Authentication |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##Windows Authentication |
|
| 6 | + |
|
| 7 | +In some cases, it is preferable to use a custom authentication system to store all authentication data, user lists, credentials etc. |
|
| 8 | +But sometimes it will be much easier to use system built-in 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 | + |
|
| 10 | +Follow these steps to set up Windows Authentication with Impersonation for the AdHoc application: |
|
| 11 | + |
|
| 12 | +##Open the Authentication settings for the website |
|
| 13 | + |
|
| 14 | +* Open IIS Manager |
|
| 15 | +* Expand the "Sites" tree and find your website |
|
| 16 | +* At the Features panel, find the IIS section and click on the Authentication icon |
|
| 17 | + |
|
| 18 | + |
|
| 19 | + |
|
| 20 | + |
|
| 21 | +##Configure Authentication settings |
|
| 22 | + |
|
| 23 | +* Disable Anonymous Authentication |
|
| 24 | +* Enable ASP.NET Impersonation |
|
| 25 | +* Enable Windows Authentication |
|
| 26 | + |
|
| 27 | + |
|
| 29 | +Or you can also set these settings manually in the web.config file at the root folder of the website. You will need to place the following settings inside the ``<system.web>`` section of your web.config: |
|
| 30 | + |
|
| 31 | +```xml |
|
| 32 | +<authentication mode="Windows" /> |
|
| 33 | +<identity impersonate="true" /> |
|
| 34 | +``` |
|
| 35 | + |
|
| 36 | + |
|
| 37 | +##Use authentication information in the AdHoc security model |
|
| 38 | + |
|
| 39 | +```csharp |
|
| 40 | +public override void PostLogin() |
|
| 41 | +{ |
|
| 42 | + WindowsIdentity user = WindowsIdentity.GetCurrent(); |
|
| 43 | + AdHocSettings.CurrentUserName = user.Name; |
|
| 44 | + AdHocSettings.CurrentUserIsAdmin = new WindowsPrincipal(user).IsInRole(WindowsBuiltInRole.Administrator); |
|
| 45 | +} |
|
| 46 | +``` |
|
| ... | ... | \ No newline at end of file |