Code Monkey home page Code Monkey logo

Comments (10)

dhirschfeld avatar dhirschfeld commented on June 6, 2024 1

This sounds like a bug. I'll check if I can reproduce to confirm...

from ldapauthenticator.

ermakovpetr avatar ermakovpetr commented on June 6, 2024

this is fact!
after update 1.1->1.2.2 have this problem

from ldapauthenticator.

ermakovpetr avatar ermakovpetr commented on June 6, 2024

If don't set bind_dn_template - bind_dn_template=[]
and isBound don't set True
https://github.com/jupyterhub/ldapauthenticator/blob/master/ldapauthenticator/ldapauthenticator.py#L315-L335

for dn in bind_dn_template:
userdn = dn.format(username=resolved_username)
msg = 'Status of user bind {username} with {userdn} : {isBound}'
try:
conn = getConnection(userdn, username, password)
except ldap3.core.exceptions.LDAPBindError as exc:
isBound = False
msg += '\n{exc_type}: {exc_msg}'.format(
exc_type=exc.__class__.__name__,
exc_msg=exc.args[0] if exc.args else ''
)
else:
isBound = conn.bind()
msg = msg.format(
username=username,
userdn=userdn,
isBound=isBound
)
self.log.debug(msg)
if isBound:
break

from ldapauthenticator.

ermakovpetr avatar ermakovpetr commented on June 6, 2024

But we can take userdn from connection after search user conn.response[0]['dn']
my temporarily dirty fix :
#88
If you ok about the idea, I try to make pull-request correctly and beautifully

from ldapauthenticator.

AnirudhVyas avatar AnirudhVyas commented on June 6, 2024

How do we set bind_dn_template?

from ldapauthenticator.

dhirschfeld avatar dhirschfeld commented on June 6, 2024

@AnirudhVyas - bind_dn_template is set in your jupyterhub_config.py file.
https://github.com/jupyterhub/ldapauthenticator#ldapauthenticatorbind_dn_template

from ldapauthenticator.

dhirschfeld avatar dhirschfeld commented on June 6, 2024

I can't reproduce and I can't follow the logic how this could be the case.

isBound is initially set to False:

If bind_dn_template is empty this entire block is skipped:

for dn in bind_dn_template:

therefore isBound is still False here and this block is also skipped:

which then falls through to the else clause which blocks access:

else:
self.log.warn('Invalid password for user {username}'.format(
username=username,
))
return None

from ldapauthenticator.

dhirschfeld avatar dhirschfeld commented on June 6, 2024

Poking around some more, it seems that if your bind_dn_template is an empty string '' then it does indeed authenticate any password :(

from ldapauthenticator.

ermakovpetr avatar ermakovpetr commented on June 6, 2024

@dhirschfeld
correctly I understand that my PR (#88) doesn't conflict your PR. and I can add functionality (get bind_dn_template from first request's response)
?

from ldapauthenticator.

dhirschfeld avatar dhirschfeld commented on June 6, 2024

@ermakovpetr - yes, I think the functionality in #88 is orthogonal to that in #95

from ldapauthenticator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.