Advertisement:

Author Topic: Ldap Authentication Mod  (Read 102717 times)

Offline jfederer

  • Newbie
  • *
  • Posts: 5
Re: Ldap Authentication Mod
« Reply #140 on: January 12, 2015, 01:33:16 PM »
Is there a current version of this -- I have searched and search and cant' seem to find it.

Offline ziycon

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,692
  • Gender: Male
Re: Ldap Authentication Mod
« Reply #141 on: January 13, 2015, 04:15:39 AM »
Still hasn't been approved due to nothing but my own fault and being busy with RL, I'll see if I can dig it up and get the wheels moving again.

Offline ispanec

  • Newbie
  • *
  • Posts: 1
Re: Ldap Authentication Mod
« Reply #142 on: March 04, 2015, 02:25:44 PM »
ziycon, is it possible to get a test version?

Offline ziycon

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,692
  • Gender: Male
Re: Ldap Authentication Mod
« Reply #143 on: March 05, 2015, 10:20:02 AM »
ziycon, is it possible to get a test version?
I'm actually talking to another team member about getting this mod cleaned up and available as soon as possible, I'll post back once it's available.

I don't like giving out code until I know it works and has been checked.

Offline tinoest

  • Development Contributor
  • Jr. Member
  • *
  • Posts: 246
Re: Ldap Authentication Mod
« Reply #144 on: June 02, 2015, 02:11:42 PM »
Hi,

As I couldn't find anything I made some minor modification to my copy of SMF and got LDAP working in my scenario. The code is attached. It's not got the level of checking I would put in if it was a Modification, but if there is enough interest. I'll look to tidy it up and make it available for that release.

I had to modify Themes/default/scripts/script.js and change the hashLoginPassword to the following;

Code: [Select]
function hashLoginPassword(doForm, cur_session_id)
{
  // Compatibility.
  if (cur_session_id == null)
    cur_session_id = smf_session_id;

  if (typeof(hex_sha1) == 'undefined')
    return;
  // Are they using an email address?
  if (doForm.user.value.indexOf('@') != -1)
    return;

  // Unless the browser is Opera, the password will not save properly.
  if (!('opera' in window))
    doForm.passwrd.autocomplete = 'off';

  doForm.hash_passwrd.value = hex_sha1(hex_sha1(doForm.user.value.php_to8bit().php_strtolower() + doForm.passwrd.value.php_to8bit()) + cur_session_id);

  // It looks nicer to fill it with asterisks, but Firefox will try to save that.
  //if (is_ff != -1)
  //  doForm.passwrd.value = '';
  //else
  //  doForm.passwrd.value = doForm.passwrd.value.replace(/./g, '*');
}


You also need to modify your Settings.php and add the following, applicable to your domain.

Code: [Select]
// LDAP Settings
$ldapSettings['host']   = 'ldap.host';
$ldapSettings['pass']   = 'ladp.password';
$ldapSettings['rdn']    = 'cn=admin,dc=domain,dc=lan';
$ldapSettings['dn']     = "dc=domain,dc=lan";

It will query the LDAP server for a login, if one is found it will check against the SMF database and if the user doesn't exist it will create the user. If the LDAP auth fails, it currently doesn't do anything it just checks the SMF database for the user, but I can modify it to fail at this point if required.

It doesn't handle a changing password on the LDAP side for those that have 30 day logins etc. Again if required it can be modified to do so.

I've tried to make the change/check as minimal as possible so a few features could be missing. It assumes you look up the user details and it matches there uid or login name.

Offline hyrsky

  • Newbie
  • *
  • Posts: 1
Re: Ldap Authentication Mod
« Reply #145 on: January 19, 2016, 08:23:18 AM »
Here is something I wrote for SMF 2.0.7 and used on a small hidden forum I manage. I have updated to SMF 2.0.11 through package manager and it is still working. Buggy as hell but if anyone is interested feel free to build on this. :)

**
Apparently I'm not allowed to post external links but /hyrsky/SMF-Ldap on github(dot)com

Offline vbgamer45

  • Customizer
  • SMF Super Hero
  • *
  • Posts: 21,557
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: Ldap Authentication Mod
« Reply #146 on: January 19, 2016, 08:45:22 AM »
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro