Chris Seymour
|
Posted: 03/13/2009, 11:37 AM |
|
Hello,
I have been asked to come up with a concept for a client's internal
website. They want it to be Single Sign On enabled (Active directory).
Has anyone done anything like this with CCS 4?
Thanks.
Chris
|
|
|
mrachow
Posts: 509
|
Posted: 03/24/2009, 12:42 PM |
|
Because server is save the client usually will name you an enviroment variable containing the login of the current user.
Of course for matching purposes you have to have these logins in the login table of your web site too.
I have had two alternatives.
First cloning the login procedure of studio and removing password verification.
The user will be logged in only by finding his login.
In the second way I have read first the password with the given user login and after that followed the usual way of logging in as if the password would have been entered.
_________________
Best regards,
Michael |
|
|
melvyn
Posts: 333
|
Posted: 03/24/2009, 5:49 PM |
|
You can reach it using LDAP modules.
Check: http://emcken.dk/weblog/archives/167-using-php-to-conne...-directory.html http://www.developer.com/lang/php/article.php/3100951
It's interesting to try that.
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com |
|
|
laneoc
Posts: 154
|
Posted: 03/24/2009, 8:20 PM |
|
I modified the login page to authenticate against LDAP instead of the MySQL database.
I used adLDAP.php to do this. Let me know if you would like more info.
Lane
_________________
Lane |
|
|
damian
Posts: 838
|
Posted: 03/25/2009, 8:22 PM |
|
*i* would like more info!
_________________
if you found this post useful take the time to help someone else.... :)
|
|
|
laneoc
Posts: 154
|
Posted: 04/04/2009, 8:08 AM |
|
The following will use LDAP as a means to authenticate users, then go against the database to get values for the logged on user (assuming the database's username is the same as the LDAP username).
I've trimmed out a bunch of special handling I needed, but hopefully this helps someone get a faster start than I did!
1. Get "adLDAP.php" from sourceforge.net and put it in your project.
2. You need to know the "Account Suffix", "Base DN", and "DCS" for your network's LDAP.
(In my app, I actually set these in one of my tables and pull them from there.)
3. Add an On Click Custom Event to your login page's Login Button with code such as the following.
(You may wish to take this code and replace the "CCLoginUser" function in common.php.)
CCLogoutUser();
$Result=false;
$username=strtoupper($login); //remove case sensitivity on the username
include ("adLDAP.php"); // The "adLDAP.php" is open source.
// Set Your ADLDAP variables $account_suffix, $base_dn, and $dcs here
$account_suffix="@hostname.net";
$base_dn="DC=hostname,DC=net";
$dcs=array ("thedomaincontroller.hostname.net));
$options=array(account_suffix=>$account_suffix,base_dn=>$base_dn,domain_controllers=>$dcs);
$adldap = new adLDAP($options);
$options=array(account_suffix=>'@cch-nt.local',base_dn=>"DC=cch-nt,DC=local",domain_controllers=>$dcs);
// Authenticate the user. My query gets the value from the "unum" column from the "users" table by matching
// the inputted login ID ($login on the form) and matching it against the column "logon_id" from the "users" table.
if ($adldap -> authenticate($username,$password))
{
$db = new clsDBYourDB(); // Your database connection here
$SQL = "SELECT unum, FROM users WHERE status = 'c' and logon_id=".$db->ToSQL($login, ccsText); // Your query here.
$db->query($SQL);
$Result = $db->next_record();
// Set Your session variables here -----------------------------------------
if ($Result)
{
CCSetSession("UserID", $db->f("unum"));
CCSetSession("UserLogin", $login);
}
}
_________________
Lane |
|
|
spdev
Posts: 2
|
Posted: 07/07/2009, 12:08 AM |
|
Hi,
I'm new to CodeCharge and have been struggling with authenticating users against Active Directory. I'm using ASP 3.0 with AD 2003.
Would it be possible for you to please give me some assistance and direction on getting this to work? Or maybe if you can send me the login pages with the code embedded?
Thanks much in advance.
Regards,
'Newbie' Sarith
|
|
|
damian
Posts: 838
|
Posted: 07/07/2009, 5:53 AM |
|
Sarith - this is using a LDAP routine that was written in PHP....
_________________
if you found this post useful take the time to help someone else.... :)
|
|
|
laneoc
Posts: 154
|
Posted: 07/07/2009, 7:49 PM |
|
Check here for ASP:
http://forums.codecharge.com/posts.php?post_id=104168&s_keyword=ldap
Lane
_________________
Lane |
|
|
|