File: ldap-sasl.rst

package info (click to toggle)
python-ldap 3.4.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,368 kB
  • sloc: python: 9,558; ansic: 3,052; makefile: 139; sh: 79
file content (84 lines) | stat: -rw-r--r-- 1,796 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
***********************************************
:py:mod:`ldap.sasl` SASL Authentication Methods
***********************************************

.. py:module:: ldap.sasl

This module implements various authentication methods for SASL bind.

.. seealso::

   :rfc:`4422` - Simple Authentication and Security Layer (SASL)
   :rfc:`4513` - Lightweight Directory Access Protocol (LDAP): Authentication Methods and Security Mechanisms


Constants
=========

.. py:data:: CB_USER

.. py:data:: CB_AUTHNAME

.. py:data:: CB_LANGUAGE

.. py:data:: CB_PASS

.. py:data:: CB_ECHOPROMPT

.. py:data:: CB_NOECHOPROMPT

.. py:data:: CB_GETREALM


Classes
=======

.. autoclass:: ldap.sasl.sasl
   :members:

   This class is used with :py:meth:`ldap.LDAPObject.sasl_interactive_bind_s()`.


.. autoclass:: ldap.sasl.cram_md5
   :members:


.. autoclass:: ldap.sasl.digest_md5
   :members:


.. autoclass:: ldap.sasl.gssapi
   :members:

   You might consider using convenience method :py:meth:`ldap.LDAPObject.sasl_gssapi_bind_s()`.


.. autoclass:: ldap.sasl.external
   :members:

   You might consider using convenience method :py:meth:`ldap.LDAPObject.sasl_external_bind_s()`.


.. _ldap.sasl-example:

Examples for ldap.sasl
^^^^^^^^^^^^^^^^^^^^^^^^

This example connects to an OpenLDAP server via LDAP over IPC
(see `draft-chu-ldap-ldapi <https://tools.ietf.org/html/draft-chu-ldap-ldapi>`_)
and sends a SASL external bind request.

::

   import ldap, ldap.sasl, urllib

   ldapi_path = '/tmp/openldap-socket'
   ldap_conn = ldap.initialize(
       'ldapi://%s' % (
           urllib.quote_plus(ldapi_path)
       )
   )
   # Send SASL bind request for mechanism EXTERNAL
   ldap_conn.sasl_non_interactive_bind_s('EXTERNAL')
   # Find out the SASL Authorization Identity
   print ldap_conn.whoami_s()