zakkak / qa-ldap-login

LDAP authentication mechanism for Question2Answer.
11 stars 14 forks source link

Merge request #13

Closed sandinosaso closed 10 years ago

sandinosaso commented 10 years ago

I edited your plugin to use another ldap authAttribute (besides de hardcoded attribute it uses now). Changed private $authenticationAttribute = "sAMAccountName"; to $this->authenticationAttribute = qa_opt('ldap_authentication_attribute'); so now it is an option you can choose, for example I use the mail attribute to validate an ldap user. Also I integrated it with Moodle, when a user logs in to Moodle it is automatically logged to q2a, also changed the logout part to redirect conditional of an GET variable, so I can make an ajax get request when user logs out moodle to logs out q2a without getting error 304 page moved temporaly.

You can see some images here: http://i57.tinypic.com/16jm2gx.png and here: http://i62.tinypic.com/2lizj35.png

If you want some of this changed be merged I will be glad to help some one else. Thanks for sharing Regards Sandino.

zakkak commented 10 years ago

Hi,

I would certainly like the authenticationAttribute change.

I also like the moodle integration think (Not sure how safe it is though). What happens if you don't provide an IP (i.e. you don't run q2a from moodle)? Does it automatically ignore this option?

I would also like some more info about how you run q2a inside moodle, is there any tutorial available to follow. Could we make q2a a moodle plugin somehow? I believe moodle is missing a good q2a.

Regards

sandinosaso commented 10 years ago

Ok, let me know the steps I need to do to merge it or create a new branch, I do not know how do you work. About moodle integration thing (http://docs.moodle.org/22/en/External_tool_settings), I can tell you that moodle sends data via post to the application you integrate (like name, email, surname, etc) what is shared to the application is selected by the moodle user who configures the external tool (in this case question2answer), with the mail attribute of the moodle looged in user I perform an acl search by the authenticationAttribute configured (mail) and If an user is found I save that user in $_SESSION as question2answer expect it, the only security it currently uses is checking that the host that sends that post is the server host you configured in the plugin options (in my case same server running moodle and question2answer), it can be improved defining some key and shared secret if more security is needed. I agree with you moodle as an education engine is missing a good q2a and this is my aproach to work with both of them.

Regards

zakkak commented 10 years ago

If you can do it as separate pull requests, one for the authenticationAttribute and another for the moodle, I would appreciate it. Maybe we could even keep the moodle changes as a branch, since I expect it to be a rare case of use.

What do you think?

sandinosaso commented 10 years ago

I agree with you I made a pull request to you review the code, it only passes the authenticationAttribute as a plugin param, I am gonna make another branch to work on the moodle authentication

sandinosaso commented 10 years ago

Can you please make another branch to the moodle integration thing, so I can make a pull request to that branch an not to master branch?, regards

zakkak commented 10 years ago

Issue another pull request with you "moodle"r branch and I will merge it in a new branch, don't worry about it.

Thanks :)

zakkak commented 10 years ago

Issue resolved, see #14 and #15.