solved Jamroom to XMPIE uStore Bridge

blindmime
@blindmime
8 years ago
772 posts
I'm interested in logging jamroom users into an XMPIE uStore. It supports LDAP. Not sure what's involved and if it's beyond my expertise. If that's the case, I'm interested having that built. Can you provide an estimate or point me in the right direction if that's not something the Jamroom team would be interested in doing?
updated by @blindmime: 01/02/17 08:50:54PM
michael
@michael
8 years ago
7,715 posts
What is XMPIE and LDAP?
blindmime
@blindmime
8 years ago
772 posts
XMPIE is a Xerox Production Environment with Adobe Server technology for web-to-print. uStore is its shopping cart. LDAP Is... LDAP stands for Lightweight Directory Access Protocol. It is an application protocol used over an IP network to manage and access the distributed directory information service. The primary purpose of a directory service is to provide a systematic set of records, usually organized in a hierarchical structure.
blindmime
@blindmime
8 years ago
772 posts
There is this thread about LDAP into Jamroom ( https://www.jamroom.net/the-jamroom-network/forum/25719/ldap-authentication ), but I'd like to go from Jamroom to another site. The user would log into Jamroom and then be able to go to the other site without logging in there as their Jamroom credentials would be used to log into the other site.
brian
@brian
8 years ago
10,148 posts
What you'd want to do in this case is create a custom LDAP module that listens for the login_success event that in turn takes the user and logs them into the site using LDAP:

http://php.net/manual/en/ref.ldap.php


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
michael
@michael
8 years ago
7,715 posts
All outside my circle of competence sorry, but on the good side, this tutorial is very closely matched to what brian is suggesting:

Docs: "Creating a Module"
https://www.jamroom.net/the-jamroom-network/documentation/jamroom-developers-guide/26/creating-a-module

Its topic is "a module that sends admin an email when someone logs in". Listen for the login event instead of the signup event and its very close to what you're after.
SteveX
SteveX
@ultrajam
8 years ago
2,584 posts
I got a little way towards LDAP authentication before I hit other problems with doing that.

This might help with making a connection and running a search

function ujLDAPauth_db_get_item_listener($_data, $_user, $_conf, $_args, $event)
{ global $_post; if (isset($_post['module']) && $_post['module'] == 'jrUser' && $_post['option'] == 'login_save') { $ip_address = 'xxxxxxxxx'; // ip address $port = 'xxxxx'; // port $ldappass = 'xxxxxxxx'; // your ldap password $ldaprdn = 'CN=svc-lookup,OU=Services,DC=subdomain,DC=domain,DC=com'; // your domain name // LDAP lookup $ds = ldap_connect($ip_address,$port); // must be a valid LDAP server! //fdebug("ds",$ds);// OK if ($ds) { //$r = ldap_bind($ds); // this is an "anonymous" bind, typically bind to ldap server with user / pass $ldapbind = ldap_bind($ds, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { fdebug("LDAP bind successful...");// OK } else { fdebug("LDAP bind failed...");// OK } // Searching for username a34-jones // echo "Searching for (sn=S*) ..."; // Search surname entry //$sr = ldap_search($ds, "DC=subdomain,DC=domain,DC=com", "cn=a34-jones"); // echo "Searching for (sn=C*) ..."; // Search surname entry // $sr=ldap_search($ds, "DC=subdomain,DC=domain,DC=com", "(uid=a34*)"); // //echo "Search result is " . $sr . "<br />"; // fdebug("search result (uid=a34*)",$sr);// OK // // fdebug( "Number of entries returned is " . ldap_count_entries($ds, $sr) . "<br />", $sr);// OK // // $sr=ldap_search($ds, "DC=subdomain,DC=domain,DC=com", "(sn=jo*)"); // // fdebug("search result for sn=jo*",$sr);// OK // // $sr=ldap_search($ds, "DC=subdomain,DC=domain,DC=com", "(sn=a34*)"); // // fdebug("search result (sn=a34*)",$sr);// OK // ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); $sr=ldap_search($ds, "DC=subdomain,DC=domain,DC=com", "cn=a34-jones"); if (!$sr) { $err_number = ldap_errno($ds); $err_txt = ldap_err2str($err_number); } fdebug("error", $err_txt, "search result sn=J*",$sr); $info = ldap_get_entries($ds, $sr); fdebug( "Data for " . $info["count"] . " items returned:<p>",$info); // for ($i=0; $i<$info["count"]; $i++) { // echo "dn is: " . $info[$i]["dn"] . "<br />"; // echo "first cn entry is: " . $info[$i]["cn"][0] . "<br />"; // echo "first email entry is: " . $info[$i]["mail"][0] . "<br /><hr />"; // } // Closing connection ldap_close($ds); } } else { return $_data; } return $_data; }



--
¯\_(ツ)_/¯ Education, learning resources, TEL, AR/VR/MR, CC licensed content, panoramas, interactive narrative, sectional modules (like jrDocs), lunch at Uni of Bristol. Get in touch if you share my current interests or can suggest better :)
blindmime
@blindmime
8 years ago
772 posts
Thanks, guys.

Tags