CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Wishes

 Login Security using LDAP

Print topic Send  topic

Author Message
chestyp

Posts: 1
Posted: 06/28/2004, 9:03 AM

Is there a way to use LDAP with the login so I do not have to create a different database of users?

Thanks

Mark
View profile  Send private message
acapp


Posts: 31
Posted: 06/28/2004, 9:18 AM

Hi Mark,

This is how I do it by modifying the Common.php file

//CCLoginUser @0-A245B510
function CCLoginUser($login, $password)
{
global $ldapconfig;
$ldapconfig['host'] = 'mycom-ds';
$ldapconfig['port'] = '389';
$ldapconfig['basedn'] = 'ou=people, dc=mycom, dc=com';

// Get Database Login Info from Database
$db = new clsDBTrainingDB();
$SQL = "SELECT emp_id, group_id FROM employee WHERE emp_login=" . $db->ToSQL($login, ccsText);
$db->query($SQL);
$result = $db->next_record();

// Compare Password with LDAP Password Routine
$ds=ldap_connect($ldapconfig['host'],$ldapconfig['port']);
$r=ldap_bind($ds);
$sr=ldap_search( $ds, $ldapconfig['basedn'], 'employeenumber=' . $login);
$count_ldap = ldap_count_entries($ds,$sr);
ldap_close($ds);

if($count_ldap<1) {
$db->close();
return result;

} else {
if(shell_exec("/usr/local/apache/htdocs/Scripts/authenticate $login $password") == true) {
CCSetSession("UserID", $db->f("emp_id"));
CCSetSession("UserLogin", $login);
CCSetSession("GroupID", $db->f("group_id"));
}
$db->close();
return result;
}
$db->close();
return result;
}
//End CCLoginUser

My script authenticate looks like this:

#!/bin/sh

set DN=`ldapsearch -h mycom-ds -b dc=mycom,dc=com "employeenumber=$1" dn`
/usr/local/ldap/bin/ldapsearch -h mycom-ds -b dc=mycom,dc=com -D "$DN" -w "$2" "employeenumber=$1" dn

I know it could probably be done better but this works for me. Obviously you can sub mycom for your ldap company.

Regards,
Andrew
View profile  Send private message
mike

Posts: 7
Posted: 11/01/2004, 3:52 AM

Please How To do this for ASP.NET C#
View profile  Send private message
peterr


Posts: 5971
Posted: 11/01/2004, 10:44 AM

http://www.google.com/search?hl=en&q=asp.net+ldap+authentication
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.