Skip to content

Commit

Permalink
update readme and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
rroemhild committed Apr 7, 2018
1 parent f2fc842 commit b599f56
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 48 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Changelog
=========

0.7.1 (2018-03-16)
0.7.1 (2018-04-07)
------------------

* Add setting FORCE_ATTRIBUTE_VALUE_AS_LIST
Expand Down
87 changes: 44 additions & 43 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,19 @@ Your configuration should be declared within your Flask config. Sample configura
LDAP_TLS_VERSION = ssl.PROTOCOL_TLSv1_2 # default: PROTOCOL_TLSv1
LDAP_CERT_PATH = '/etc/openldap/certs'
TIf you want to allways get the entry attribute value as a list, instead of a string if only one item is in the attribute set:
If you want to always get any entry attribute value as a list, instead of a string if only one item is in the attribute list, then set:

.. code-block:: python
FORCE_ATTRIBUTE_VALUE_AS_LIST = True
Create the ldap instance within your application:
Default is ``False`` and will return a string if only one item is in the attribute list.


Setup
-----

Create the LDAP instance in your application.

.. code-block:: python
Expand Down Expand Up @@ -159,7 +165,7 @@ Authenticate with Client
with app.app_context():
retval = ldap.authenticate(username, password, attribute,
basedn, search_filter')
basedn, search_filter)
if not retval:
return 'Invalid credentials.'
return 'Welcome %s.' % username
Expand All @@ -168,13 +174,14 @@ Authenticate with Client
Bind as user
------------

To bind as user for the current request save a new connection to ``flask.g.ldap_conn``:
To bind as user for the current request instance a new connection from ``flask.g.ldap_conn``:

.. code-block:: python
g.ldap_conn = ldap.connect(userdn, password)
user = User.query.get(userdn)
Unit Test
---------

Expand Down

0 comments on commit b599f56

Please sign in to comment.