devsnd / cherrymusic

Stream your own music collection to all your devices! The easy to use free and open-source music streaming server.
http://www.fomori.org/cherrymusic
GNU General Public License v3.0
1.03k stars 187 forks source link

Get users from LDAP #690

Open nis65 opened 7 years ago

nis65 commented 7 years ago

I would like cherrymusic to be able to get users from (and authenticate against) an LDAP server. Is there any way to achieve this? There is probably a way to ask apache to do the authentication and trust this authentication. Apache can be easily configured to perform an LDAP authentication (e.g. with an AuthzProviderAlias)

My goal is that every user of my household has one single password to login to a Ubuntu PC (works), the samba shares (works) and now for cherrymusic.

nis65 commented 6 years ago

I have implemented this now by myself:

Unfortunately, I am a complete python newbie and I am sure that there are more elegant ways to implement this (e.g. by hooks?). Is there anyone willing to have a look at my changes and give some hints how to do this "the right way"? Currently the new behaviour is hard coded, I guess this should be configurable in order not to break existing installations.

httphandler.py.txt

tilboerner commented 6 years ago

@nis65 Without having had a proper look (it's late...): Very interesting. Good job figuring out how to work with our funny code!

Which brings me to my first comment: If you're starting out with Python, don't use CherryMusic code as an example how things should be done! It works, but we also had a lot to learn back then, and a lot of things are quite... quirky and unconventional as a result.

That being said, thanks for putting in the effort to make this work. I won't have time this week, but I'll gladly take a closer look after that.

nis65 commented 6 years ago

@tilboerner Thanks for your interest, I'm looking forward to your comments. I am not about to become a developer, so there is no need to be afraid of spoiling me ;-) My main interest is a decent self hosted music streaming web application and I am very happy with the UI and the (indexing) speed of CherryMusic. To make it my perfect music web app, I just want LDAP integration. But it looked like I am the only one with this itch, so I had to scratch myself...

With a little help from a python dev I found the "entry point" and fought my way through the jungle from there ;-)