简体   繁体   English

使用Angular.JS Active Directory身份验证的ASP.NET MVC4应用程序

[英]ASP.NET MVC4 application using Angular.JS Active Directory Authentication

Im writing a web app using C# with ASP.NET 4.5/Entity as a backend. 我使用ASP.NET 4.5 / Entity作为后端使用C#编写Web应用程序。 With Angular.js handling most of the front-end/database query stuff. 使用Angular.js处理大多数前端/数据库查询内容。 ASP.NET 4.5 makes it really easy to connect to our active directory using windows authentication. ASP.NET 4.5使得使用Windows身份验证连接到我们的活动目录变得非常容易。

However will I run into problems when I scrap all the razor templates, and replace it with regular HTML/CSS and angular scripts. 但是,当我刮掉所有剃刀模板并将其替换为常规HTML / CSS和角度脚本时,我会遇到问题。 All I really need the active directory stuff for is to create permission for who can pull what file from our database. 我真正需要的活动目录内容是创建权限,让谁可以从我们的数据库中提取什么文件。

Im pretty new to web apps, so far ive like the entity framework alot, but if you guys know a more efficient way (better back end) to do this feel free to tell me. 我对网络应用程序还很陌生,到目前为止,它仍然很像实体框架,但是如果你们知道一种更有效的方法(更好的后端),可以随时告诉我。

My app basically needs to allow users to upload spreadsheets and videos, search for them, and only allow access to users that are in certain AD groups. 我的应用程序基本上需要允许用户上传电子表格和视频,进行搜索,并且只允许访问特定广告组中的用户。

We solved this problem by using MVC to render the HTML templates. 我们通过使用MVC呈现HTML模板解决了此问题。 In your controller or directive set the templateUrl to an action which does whatever logic is necessary to render the template for that user. 在控制器或指令中,将templateUrl设置为一个动作,该动作执行为该用户呈现模板所需的任何逻辑。 Also, be sure to check user permissions in your AJAX calls. 另外,请确保在AJAX调用中检查用户权限。

Figured it out. 弄清楚了。 Made a new web api controller 制作了一个新的Web API控制器

then added this function 然后添加了这个功能

        public string getUser()
    {
        return User.Identity.Name;
    }

haha that was easy. 哈哈,那很容易。

However if anyone sees any errors i may run into doing it this way. 但是,如果有人看到任何错误,我可能会遇到这种情况。 Please point em out 请指出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM