使用来自windowsMembership函数的MSSQL进行Moodle外部数据库身份验证

时间:2014-03-14 15:10:50

标签: php asp.net-membership moodle

我正在使用Moodle并将其与使用MemberShip功能的新开发的ASP.NET应用程序集成..... 我尝试过MD5哈希,SHA-1哈希以及...... 当我尝试使用文本作为密码foramt它工作..感觉编码和解码有一些问题...帮助将不胜感激....

我有从会员表创建的userName和密码,并创建了一个视图,并尝试从我的moodle访问它...行有userName和密码,我无法访问它

编辑: 当我尝试调试这个时,我可以看到MSSQL中存储的密码与moodle在查询中发送的方式不同。请在下面找到php日志...

请帮帮我们......

存储在MSSQL中的密码

uMg8WgxqP+mB3hzcwbeAPqHnty4=                                                                                                     danielmoses

在moodle的外部数据库设置页面中将散列配置为SHA-1时记录

[16-Mar-2014 08:47:40 UTC] sqlsrv_configure: SQLSTATE = IMSSP
[16-Mar-2014 08:47:40 UTC] sqlsrv_configure: error code = -14
[16-Mar-2014 08:47:40 UTC] sqlsrv_configure: message = An invalid parameter was passed to sqlsrv_configure.
[16-Mar-2014 08:47:40 UTC] <hr>connecting... hostname: localhost params: array (
'Database' => 'kpadb',
'UID' => 'sa1',
'PWD' => 'password',
)
**[16-Mar-2014 08:47:40 UTC] <hr>running query: 'SELECT *
FROM MoodleAuthentication
WHERE UserName = \'danielmoses\'
AND Password = \'58cb4e2f82599535955e97a110eee6f429cd666d\''<hr>input array: false<hr>result: NULL**
[16-Mar-2014 08:47:40 UTC] (before) ADODB_COUNTRECS: 1 _numOfRows: -1 _numOfFields: -1
[16-Mar-2014 08:47:40 UTC] (after) _numOfRows: -1 _numOfFields: 2
[16-Mar-2014 08:47:40 UTC] _fetch()
[16-Mar-2014 08:47:40 UTC] fetch mode: assoc
[16-Mar-2014 08:47:40 UTC] <hr>after _fetch, fields: <pre> backtrace: <pre align=left> &nbsp; &nbsp; &nbsp; &nbsp; <font face="Courier New,Courier">ADORecordset_mssqlnative._fetch()</font><font color=#808080 size=-1> % line 2989, file: <a href="file:/C:\inetpub\wwwroot\moodle\lib\adodb\adodb.inc.php">adodb.inc.php</a></font>
&nbsp; &nbsp; &nbsp; <font face="Courier New,Courier">ADORecordSet.Init()</font><font color=#808080 size=-1> % line 1086, file: <a href="file:/C:\inetpub\wwwroot\moodle\lib\adodb\adodb.inc.php">adodb.inc.php</a></font>
&nbsp; &nbsp; <font face="Courier New,Courier">ADOConnection._Execute(SELECT * FROM MoodleAuthentication WHERE UserName = '..., false)</font><font color=#808080 size=-1> % line 1044, file: <a href="file:/C:\inetpub\wwwroot\moodle\lib\adodb\adodb.inc.php">adodb.inc.php</a></font>
&nbsp; <font face="Courier New,Courier">ADOConnection.Execute(SELECT * FROM MoodleAuthentication WHERE UserName = '...)</font><font color=#808080 size=-1> % line 117, file: <a href="file:/C:\inetpub\wwwroot\moodle\auth\db\auth.php">auth.php</a></font>
<font face="Courier New,Courier">auth_plugin_db.user_login(danielmoses, Dan@1234)</font><font color=#808080 size=-1> % line 4393, file: <a href="file:/C:\inetpub\wwwroot\moodle\lib\moodlelib.php">moodlelib.php</a></font>
<font face="Courier New,Courier">authenticate_user_login(danielmoses, Dan@1234)</font><font color=#808080 size=-1> % line 140, file: <a href="file:/C:\inetpub\wwwroot\moodle\login\index.php">index.php</a></font>
</pre>

在moodle的外部数据库设置页面中将哈希配置为MD-5时记录

[16-Mar-2014 08:56:37 UTC] sqlsrv_configure: SQLSTATE = IMSSP
[16-Mar-2014 08:56:37 UTC] sqlsrv_configure: error code = -14
[16-Mar-2014 08:56:37 UTC] sqlsrv_configure: message = An invalid parameter was passed to sqlsrv_configure.
[16-Mar-2014 08:56:37 UTC] <hr>connecting... hostname: localhost params: array (
'Database' => 'kpadb',
'UID' => 'sa1',
'PWD' => 'password',
)
**[16-Mar-2014 08:56:37 UTC] <hr>running query: 'SELECT *
FROM MoodleAuthentication
WHERE UserName = \'danielmoses\'
AND Password = \'4518af96674e69424360f61f1f6d129c\''<hr>input array: false<hr>result: NULL**
[16-Mar-2014 08:56:37 UTC] (before) ADODB_COUNTRECS: 1 _numOfRows: -1 _numOfFields: -1
[16-Mar-2014 08:56:37 UTC] (after) _numOfRows: -1 _numOfFields: 2
[16-Mar-2014 08:56:37 UTC] _fetch()
[16-Mar-2014 08:56:37 UTC] fetch mode: assoc
[16-Mar-2014 08:56:37 UTC] <hr>after _fetch, fields: <pre> backtrace: <pre align=left> &nbsp; &nbsp; &nbsp; &nbsp; <font face="Courier New,Courier">ADORecordset_mssqlnative._fetch()</font><font color=#808080 size=-1> % line 2989, file: <a href="file:/C:\inetpub\wwwroot\moodle\lib\adodb\adodb.inc.php">adodb.inc.php</a></font>
&nbsp; &nbsp; &nbsp; <font face="Courier New,Courier">ADORecordSet.Init()</font><font color=#808080 size=-1> % line 1086, file: <a href="file:/C:\inetpub\wwwroot\moodle\lib\adodb\adodb.inc.php">adodb.inc.php</a></font>
&nbsp; &nbsp; <font face="Courier New,Courier">ADOConnection._Execute(SELECT * FROM MoodleAuthentication WHERE UserName = '..., false)</font><font color=#808080 size=-1> % line 1044, file: <a href="file:/C:\inetpub\wwwroot\moodle\lib\adodb\adodb.inc.php">adodb.inc.php</a></font>
&nbsp; <font face="Courier New,Courier">ADOConnection.Execute(SELECT * FROM MoodleAuthentication WHERE UserName = '...)</font><font color=#808080 size=-1> % line 117, file: <a href="file:/C:\inetpub\wwwroot\moodle\auth\db\auth.php">auth.php</a></font>
<font face="Courier New,Courier">auth_plugin_db.user_login(danielmoses, Dan@1234)</font><font color=#808080 size=-1> % line 4393, file: <a href="file:/C:\inetpub\wwwroot\moodle\lib\moodlelib.php">moodlelib.php</a></font>
<font face="Courier New,Courier">authenticate_user_login(danielmoses, Dan@1234)</font><font color=#808080 size=-1> % line 140, file: <a href="file:/C:\inetpub\wwwroot\moodle\login\index.php">index.php</a></font>
</pre>

1 个答案:

答案 0 :(得分:0)

可能是密码腌制

http://docs.moodle.org/25/en/Password_salting

虽然我建议使用外部数据库身份验证来同步来自asp.net系统的用户

http://docs.moodle.org/26/en/External_database_authentication