[python-ldap] testing for credentials

Rob McBroom mailinglist0 at skurfer.com
Fri Jul 6 19:35:03 CEST 2012


I'd like my scripts to attempt Kerberos, but fall back to simple authentication if that fails. If I do this:

    import ldap.sasl
    auth_tokens = ldap.sasl.gssapi()

Is there something about `auth_tokens` I can use to determine whether or not a valid Kerberos ticket exists? The object appears to be identical with or without credentials. If I try to bind, the difference becomes apparent, but I'd obviously like to know which type of authentication to use *before* the bind.

I could run `klist -s` and check the exit code like an animal, but I was hoping for a simpler way.

Thanks.

-- 
Rob McBroom
<http://www.skurfer.com/>



More information about the python-ldap mailing list