我想创建和iOS应用程序,需要用户凭据,并与AD服务器进行验证。有一些建于X code库要做到这一点,或者是第三者?
I am trying to create and iOS app that takes a users credentials and verifies it with the AD server. Is there some built in library in xCode to do that, or is it third party?
在向任何意见,看看会大大AP preciated。
Any advice on direction to look would be greatly appreciated.
谢谢 扎克
推荐答案好了,这是我用来做连接到LDAP服务器的PHP。我不是100%肯定,这里发生了什么,我得到这个code从IT协调员在我的公司。我了解所有的约束力和搜索部分,但我没有得到这整个事情的ldap_set_option一部分。无论如何设置它这种方式后,就可以调用PHP脚本的URL,并把它传递参数。看看PHP的,和URL例如用低于。
Ok, so this was the PHP i used to make the connection to the ldap server. i am not 100% sure what is happening here, i got this code from IT Coordinator at my company. I understand all the binding and searching parts, but i dont get the the ldap_set_option part of this whole thing. Anyway after setting it up this way, you can then call the URL of the php script and pass it parameters. take a look at the PHP, and the url example with be below.
<?php //Connection parameters $dn = "DC=network,DC=net"; $host = "ldap://ldapwork"; $port = 1111 $user = $_GET['user']; $pass = $_GET['pass']; //$user = "user@network"; //$pass = "pass"; $filter = "memberof"; $keyword = "CN=USSC_ALL,CN=Users,DC=network,DC=net"; $filter = "objectclass"; $keyword = "user"; $filter = "objectcategory"; $keyword = "CN=Person,CN=Schema,CN=Configuration,DC=network,DC=net"; //The real thing with PHP if (!empty($keyword) and !empty($dn)) { //Connect to the AD $adConn = ldap_connect($host, $port) or die("Could not connect!"); //Set protocol verison ldap_set_option($adConn, LDAP_OPT_PROTOCOL_VERSION, 3) or die ("Could not set ldap protocol1"); //Set referrals... Won't work without this... ldap_set_option($adConn, LDAP_OPT_REFERRALS, 0) or die ("Could not set ldap protocol2"); //Bind the user $bd = ldap_bind($adConn, $user, $pass) or die ("Could not bind"); echo $bd; //End binding ldap_unbind($adConn); } else { echo "<p>No results found!</p>"; } ?> </body> </html>
确定,所以现在所有你需要做的就是通过一个用户名和密码的脚本,它将返回绑定。这将使你真或假。这意味着,如果它成功地约束是用户名和密码的正确组合。
Ok so now all you have to do is pass a username and password to the script and it will return the bind. that will give you either true or false. meaning if it bound successfully it is a correct combination of username and password.
这是我如何调用它:
192.268.192.1/ldap.php?user=(username here)&pass=(password here)这是我采取的方法,我认为这是一个非常简单的答案。
This is the approach that i took, and i think it is a very simple answer.
更多推荐
如何使用iOS应用程序进行身份验证到Active Directory
发布评论