Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple bind templates #23

Merged
merged 7 commits into from
Jan 12, 2017
Merged

Conversation

kishorchintal
Copy link
Contributor

No description provided.

1. modified bind_Dn_template from Unicode to List
2. Added the logic to handle multiple DNs
@yuvipanda
Copy link
Collaborator

Thank you very much for the patch! Apologies for the late review, I've been on vacation.

Copy link
Collaborator

@yuvipanda yuvipanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general, style and backwards compat issues :) Thanks a lot for the patch! <3

@@ -28,7 +28,7 @@ def _server_port_default(self):
help='Use SSL to encrypt connection to LDAP server'
)

bind_dn_template = Unicode(
bind_dn_template = List(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should allow this to continue to be a Unicode, to prevent backwards compatibility issues. This could be done with a Union traitlet type I think.

conn = ldap3.Connection(server, user=userdn, password=password)
self.log.debug("GOT LDAP CONNECTION FOR USER: '%s'", conn)
isBound = conn.bind()
self.log.debug("CONN_BIND: "+ str(isBound) + ":" + username )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all logging, you can use format strings instead of explicit concatenation.

self.log.debug('Attempting to bind with dn %s', dn)


isBound = False
for dn in self.bind_dn_template:
#self.log.debug("LOOPING DN")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the commented out line?

for dn in self.bind_dn_template:
#self.log.debug("LOOPING DN")
userdn = dn.format(username=username)
self.log.debug("DN: '%s'", userdn)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These four logging statements can probably be collapsed into two:

  1. Specify the username being checked and the userdn being used
  2. Specify status of bind

@yuvipanda
Copy link
Collaborator

Hey @kishorchintal. Are you still interested in taking this patch through, or would you like me to work through making these changes myself?

@yuvipanda
Copy link
Collaborator

I'll probably pick this up in a week or so if there's no response :)

@kishorchintal
Copy link
Contributor Author

kishorchintal commented Nov 29, 2016 via email

@yuvipanda
Copy link
Collaborator

yuvipanda commented Nov 29, 2016 via email

@kishorchintal
Copy link
Contributor Author

@yuvipanda - I've made the changes suggested, pls review.

@minrk
Copy link
Member

minrk commented Jan 12, 2017

Looks like review has been addressed. Thanks, @kishorchintal!

@minrk minrk merged commit e42d717 into jupyterhub:master Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants