断开连接的 Active Directory 的 ASP.NET MVC3 开发实践
我正在启动一个新的 MVC 3 应用程序,同时我正在过渡到一个更加断开连接的开发环境,在该环境中我只会偶尔连接到公司网络进行部署。
我通常使用 [Authorize(Roles = @"xxx,yyy")] 属性来处理基本的组身份验证,但是当然,当我在开发过程中断开连接时,这将不起作用。
有人对这种情况有什么建议或最佳实践吗?
I'm starting a new MVC 3 application at the same time I'm transitioning to a more disconnected development environment where I will only occasionally be connected to the corporate network to do deployments.
I have normally used the [Authorize(Roles = @"xxx,yyy")] attributes to handle basic group authentication, but of course when I'm disconnected doing development, this will not work.
Does anyone have any suggestions or best practices for this kind of situation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每当您需要针对您可能无法完全(或任何)访问的资源进行开发时,您都应该考虑使用模拟框架。 Moq 和 Rhino Mocks 只是用于此目的的两个更流行的框架。
这个想法是创建一个您的代码将使用的接口,以便您可以根据您正在使用的环境交换实际的 AD 提供程序或模拟框架。
Any time you need to do development against a resource that you may not have full (or any) access to, you should consider a mocking framework. Moq and Rhino Mocks are just two of the more popular frameworks for this purpose.
The idea is to create an interface that your code will use so that you can swap in the actual AD provider or the mocking framework depending upon which environment you're working with.