Skip to content

Commit

Permalink
Add ldap tls option.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Skiepko committed May 16, 2017
1 parent a5abd9d commit f281e02
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Changelog for dila
0.4.1 (unreleased)
------------------

- Nothing changed yet.
- Add ldap tls option.


0.4.0 (2017-05-16)
Expand Down
4 changes: 4 additions & 0 deletions dila/application/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@ def get_user_records(username):
def initialize_connection():
connection = ldap.initialize(config.LDAP_SERVER_URI)
connection.protocol_version = ldap.VERSION3
if config.LDAP_START_TLS:
connection.start_tls_s()
for key, value in config.LDAP_GLOBAL_OPTIONS:
connection.set_option(key, value)
yield connection
connection.unbind_s()
2 changes: 2 additions & 0 deletions dila/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"first_name": "givenName",
"last_name": "sn",
}
LDAP_START_TLS = False
LDAP_GLOBAL_OPTIONS = {}

def setup_from_module(module_name):
module = __import__(module_name)
Expand Down

0 comments on commit f281e02

Please sign in to comment.