Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
7 - 2 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
   

Re: Help AutoLogin to Xoops
by Anonymous on 2003/10/22 10:26:36

To check the User or get the User from LDAP you have to get the Information from the LDAP Server like this:

le="color: #000000"><?php function getUser($userName, $includeGroups=false) { global $xoopsConfig; $this->error = null; $userObj = null; $entryDN = $xoopsConfig['ldapusercont']; $filter = "(cn=".$userName.")"; $justthese = array("uidnumber", "cn", "gecos", "webidsynchid"); if($includeGroups) { $justthese[] = "groupmembership"; } $info = $this->findLDAPObject($entryDN, $justthese, $filter); if(!$info) { $this->error = "User $userName not found"; unset($justthese); return null; } $userObj = new xoopsLDAPUser; $userObj->dn = $info[0]["dn"]; $userObj->cn = $info[0]["cn"][0]; $userObj->extid = $info[0]["webidsynchid"][0]; if(isset($info[0]["uidnumber"][0])) { $userObj->uid = $info[0]["uidnumber"][0]; $userObj->gecos = $info[0]["gecos"][0]; } if ($info[0]["groupmembership"]["count"] > 0) { $userObj->groups = array(); for($i = 0; $i < $info[0]["groupmembership"]["count"]; $i++) { $userObj->groups[] = $info[0]["groupmembership"][$i]; } } unset($info); return $userObj; }


This is just a example there must be more inside, so it would be an own Class for connecting to the LDAP Server:

le="color: #000000"><?php function connect() { global $xoopsConfig; $this->error = null; $server = ($xoopsConfig['ldapcleartext'] == 1) ? "ldap" : "ldaps"; $server .= "://" . $xoopsConfig['ldapserver']; $this->conn = ldap_connect($server, $xoopsConfig['ldapserverport']); if(!$this->conn) { $this->conn = null; $this->error = "Failed connection to " . $server; return false; } return true; }


Get an LDAP object associated with a given DN

le="color: #000000"><?php function findLDAPObject($dn, $attributes=null, $filter=null) { $this->error = null; if(!$filter) { $filter = "(objectclass=*)"; } $sr = ldap_search($this->conn, $dn, $filter, $attributes); if(!$sr) { return $this->returnLDAPFailure("Search for Object: $dn"); } if(ldap_count_entries($this->conn, $sr) < 1) { $this->error = "No entries found for $dn"; return false; } $info = ldap_get_entries($this->conn, $sr); return $info; }


le="color: #000000"><?php function returnLDAPFailure($prefString) { $this->error = $prefString . " LDAP Error: " . ldap_err2str(ldap_errno($this->conn)); return false; } // Private // Authenticate a user specified by a given DN // using a given password. function doBind($userDN, $password) { global $xoopsConfig; $this->bound = false; $this->error = null; if(!$this->conn) { if(!$this->connect()) { return false; } } ldap_bind($this->conn, $userDN, $password); if(ldap_errno($this->conn) != 0) { $userDN .= " LDAP Server: " . $xoopsConfig['ldapserver']; return $this->returnLDAPFailure("Bind DN: " . $userDN); } $this->bound = true; return true; } // Do authentication for the admin function bindAdmin() { global $xoopsConfig; return $this->doBind($xoopsConfig['ldapadmin'], $xoopsConfig['ldapadminpass']); }


So happy Xoopsing

Greetz Predator
Re: Help AutoLogin to Xoops
by Society on 2003/10/22 6:18:16

same for me :) i tried some wired things
but i get it not to work :)

Autologin is not the problem the problem is ldap
Help AutoLogin to Xoops
by GuillauG on 2003/10/22 4:36:35

Hi,
I want the user coming on my Intranet be auto login in XOOPS if their user exist on a LDAP server.

I already make a PHP who get the username via a JavaScript and then return the value to the PHP via a $_Post and this PHP verify if the user exist in LDAP. Now i want to modify Login section on XOOPS so the user will be autologged with his windows session.

How can i do that?

thanks!

Who's Online

128 user(s) are online (87 user(s) are browsing Support Forums)


Members: 0


Guests: 128


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits