我在 FreeBSD 机器上运行 Python 2.6,我想对事件目录进行两阶段身份验证(我不知道正确的术语)。
基本上,登录用户“myuserid”的过程是:
- 使用为此目的创建的系统帐户绑定(bind)到 AD LDAP 服务器(将其称为
DOMAIN\gatekeeper
)
- 根据 AD 中存储的该用户的凭据验证
myuserid
的密码。
我有以下代码,它看起来很像 this question 中的代码.
l = ldap.initialize(Server)
l.protoco_version = 3
l.set_option(ldap.OPT_REFERRALS, 0)
l.simple_bind_s('cn=gatekeeper,dc=DOMAIN,dc=COMPANY,dc=TLD', 'gatekeeper_password')
最后会导致此错误:
=> LDAPError - INVALID_CREDENTIALS: {'info': '80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece', 'desc': 'Invalid credentials'}
---------------------------------------------------------------------------
INVALID_CREDENTIALS Traceback (most recent call last)
/Users/crose/projects/ldap-auth/9163_saas/webservices/aws/model/aw_registry/<ipython console> in <module>()
/Users/crose/virtualenv/ldap-auth/lib/python2.6/site-packages/ldap/ldapobject.pyc in simple_bind_s(self, who, cred, serverctrls, clientctrls)
205 """
206 msgid = self.simple_bind(who,cred,serverctrls,clientctrls)
--> 207 return self.result(msgid,all=1,timeout=self.timeout)
208
209 def bind(self,who,cred,method=ldap.AUTH_SIMPLE):
/Users/crose/virtualenv/ldap-auth/lib/python2.6/site-packages/ldap/ldapobject.pyc in result(self, msgid, all, timeout)
420 polling (timeout = 0), in which case (None, None) is returned.
421 """
--> 422 res_type,res_data,res_msgid = self.result2(msgid,all,timeout)
423 return res_type,res_data
424
/Users/crose/virtualenv/ldap-auth/lib/python2.6/site-packages/ldap/ldapobject.pyc in result2(self, msgid, all, timeout)
424
425 def result2(self,msgid=ldap.RES_ANY,all=1,timeout=None):
--> 426 res_type, res_data, res_msgid, srv_ctrls = self.result3(msgid,all,timeout)
427 return res_type, res_data, res_msgid
428
/Users/crose/virtualenv/ldap-auth/lib/python2.6/site-packages/ldap/ldapobject.pyc in result3(self, msgid, all, timeout)
430 if timeout is None:
431 timeout = self.timeout
--> 432 ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout)
433 if ldap_result is None:
434 rtype, rdata, rmsgid, decoded_serverctrls = (None,None,None,None)
/Users/crose/virtualenv/ldap-auth/lib/python2.6/site-packages/ldap/ldapobject.pyc in _ldap_call(self, func, *args, **kwargs)
94 try:
95 try:
---> 96 result = func(*args,**kwargs)
97 if __debug__ and self._trace_level>=2:
98 if func.__name__!="unbind_ext":
INVALID_CREDENTIALS: {'info': '80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error, data 525, vece', 'desc': 'Invalid credentials'}
我看到的每个教程似乎都假定我在 Windows 上运行,但事实并非如此。我如何在 Unix 上执行此操作?
我是一名优秀的程序员,十分优秀!