D wrote:
> Is it possible to have Python authenticate with Active Directory?
> Specifically what I'd like to do is have a user enter a
> username/password, then have Python check the credentials with AD - if
> what they entered is valid, for example, it returns a 1, otherwise a
> 0..  Thanks!

Install the Win32 extensions from 
http://starship.python.net/crew/skippy/win32/Downloads.html and do 
something like this:

try:
     handle=win32security.LogonUser(username, None, password,
                   win32security.LOGON32_LOGON_NETWORK,
                   win32security.LOGON32_PROVIDER_DEFAULT)

     # We're not going to use the handle, just seeing if we can get it.
     handle.Close()
     return True
except pywintypes.error, e:
     # Because of the sheer number of Windows-specific errors that can
     # occur here, we have to assume any of them mean that the
     # credentials were not valid.
     return False
--
Benji York
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to