简体   繁体   English

测试从Windows身份验证到SQL Server身份验证的过渡

[英]Test transition from Windows Authentication to SQL Server authentication

I have a windows forms application which connects to an SQL Server 2008 R2 database using variously SMO, databinding, and ODBC connections. 我有一个Windows窗体应用程序,该应用程序使用各种SMO,数据绑定和ODBC连接连接到SQL Server 2008 R2数据库。

Currently it uses entirely Windows authentication, but a client has requested that we also allow SQL Server logins. 当前,它完全使用Windows身份验证,但是一个客户要求我们也允许SQL Server登录。

Given the only Windows login I have, and can have, is my own, what can I do to test whether my code is actually using the SQL Server login and not simply connecting using my own Windows login? 鉴于我拥有并且可以拥有的唯一Windows登录名,该如何测试我的代码是否实际上是使用SQL Server登录名而不是简单地使用自己的Windows登录名进行连接?

Alternatively, what can I do to refine this question so it makes sense? 另外,我可以做些什么来完善这个问题,使之有意义?

Thanks 谢谢

Your question is too general but here are some steps you should take. 您的问题过于笼统,但是您应该采取一些步骤。

  1. Create new sql login and only give necessary permissions to this user 创建新的SQL登录名,并仅授予该用户必要的权限
  2. Update all connection strings in your application. 更新您的应用程序中的所有连接字符串。 If these are not consolidated in one config file now is the good time to do this. 如果现在不将这些文件合并到一个配置文件中,则是进行此操作的好时机。 You can even consider creating a separate class that will handle this. 您甚至可以考虑创建一个单独的类来处理此问题。
  3. Add login form to your app that will be shown at the application startup so that user can enter credentials 将登录表单添加到您的应用中,该表单将在应用启动时显示,以便用户可以输入凭据

Best way to test this is to simply disable your windows user in SQL Server and see if application is still running. 最好的测试方法是在SQL Server中禁用Windows用户,然后查看应用程序是否仍在运行。

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

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