I would like this! And I think many office workers will like it too.
There is allready too much user/password hassle in this world..
Jarkko
----- Original Message -----=20
From: Thomas Bley=20
To: moregroupware-dev@...
Sent: Monday, October 21, 2002 9:37 PM
Subject: Re: [mgw-dev] NTLM & MGW
Hi,
NTLM offers windows users to get authenticated to a web server without =
typing their password in.
The client sents a hash of the password to the webserver, then the=20
webserver sents it to the domain controller (WinNT or W2k).
People don't need to type in their credentials when they log in to =
mgw.=20
(and it's also secure)
--> The users are authenticated by the domain controller, they don't=20
even need to know their mgw-password.
(Using ldap authentication requires the administrator-password of the=20
active directory controller, this is bad.)
line 75: this was only for the test, I attached a new index.php.
index.php also needs a check to appconf (-> setup, e.g. =
$use_ntlm_auth) at:
line 36: (isset($_SERVER["REMOTE_USER"])) -->=20
(isset($_SERVER["REMOTE_USER"]) and $use_ntlm_auth)
sql.inc:
line 5: global $conn,$_SERVER, $_POST; --> global =
$conn,$_SERVER,=20
$_POST, $use_ntlm_auth;
line 7: (isset($_SERVER["REMOTE_USER"]) and -->=20
(isset($_SERVER["REMOTE_USER"]) and $use_ntlm_auth and
bye
tom
Karsten Dambekalns wrote:
>On Mon, Okt 21, 2002 at 12:02:59 +0200, Thomas Bley wrote:
> =20
>
>>Hi,
>>
>>Here are some patches using NTLM (or basic / digest auth) with MGW:
>>look at the attachments:
>>- mgw/index.php
>>- mgw/modules/general/templates/default/html/login.tpl
>>- mgw/include/Auth/sql.inc
>>
>>Perhaps we can make "authenticating by REMOTE_USER" configurable in =
setup ?
>> =20
>>
>
>Ah, ok, now I understand what this checkbox on your screenshot
>is... :)
>
>Well, do we need this? Why is this a Good Thing? To make mgw easier =
to
>integrate in existing setups?
>
>BTW, is the false in the check on line 75 a left over thing from
>testing? I guess so, no?
>
>Well, I don't care too much about this, but if there are no other
>opinions, I am not against it, either, if we make it possible to
>disable this.
>
>
>Karsten
> =20
>
-------------------------------------------------------------------------=
-----
Please run SETUP first."); // =
-------------------------------------------------------------------- =
$myEnv["module"] =3D "general"; $myEnv["output"] =3D "html"; =
$myEnv["translate"] =3D true; $myEnv["stdsmenu"] =3D false; =
$myEnv["auth"] =3D false; include('config.inc.php'); include(INCLUDEPATH =
."container.inc"); $num =3D 1; $conn =3D connect_database(); =
if($_SERVER["REQUEST_METHOD"] =3D=3D "POST"){ $loginlang =3D =
$_POST["language"]; $lsql =3D "SELECT charset FROM mgw_languages WHERE =
langcode=3D".$conn->quote($_POST["language"]); if (!$lres =3D =
$conn->Execute($lsql)) exit(showSQLerror($sql, $conn->ErrorMsg(), =
__LINE__, __FILE__)); $lrow =3D $lres->FetchRow(); $logincharset =3D =
$lrow["charset"]; } else{ $loginlang =3D $appconf["def_language"]; =
$logincharset =3D $appconf["def_charset"]; } =
setLocaledText($loginlang,"general"); =
$smarty->assign("charset",$logincharset); $login =3D =
(IsSet($_POST["login"]) ? $_POST["login"] : ""); $password =3D =
(IsSet($_POST["password"]) ? $_POST["password"] : ""); if =
(isset($_SERVER["REMOTE_USER"])) { $mylogin =3D =
substr($_SERVER["REMOTE_USER"],strpos($_SERVER["REMOTE_USER"],"\\")+1); =
$mylogin =3D str_replace("\\","",$mylogin); $smarty->assign("mylogin", =
$mylogin); if (isset($_POST["noautologin"])) { if =
($_POST["noautologin"]) {$smarty->assign("noautologin", "checked");} =
else {$smarty->assign("noautologin", "");} } if =
(!isset($_POST["noautologin"]) or !$_POST["noautologin"]) { $login =3D =
$mylogin; } } if(IsSet($_GET["view"]) && $_GET["view"]=3D=3D"logout"){ =
$_SESSION =3D array(); session_destroy(); } if =
(!isset($_POST["loginbutton"]) && (!isset($_SESSION["username"]))) { =
include(INCLUDEPATH . "mSelectBox.class.inc"); $lsb =3D new =
mSelectBox("language"); $lsb->setContentType("sql"); =
$lsb->setSQLvalue("langcode"); $lsb->setSQLcontent("description"); =
$lsb->addContent("SELECT langcode, description FROM mgw_languages ORDER =
BY description"); $smarty->assign("lsb", $lsb->draw($loginlang, =
'onchange=3D"document.f1.submit()"')); $smarty->display("login.tpl"); } =
else if (isset($_SESSION['MGW']) && !isset($_POST["loginbutton"])) { =
redirect("modules/".$_SESSION["MGW"]->settings["def_module"]."/index.php?=
".SID); } else if (isset($_POST["loginbutton"])) { // ATIF: first =
authentify the user via ldap or sql // no authentification, no access =
$sql =3D "SELECT is_ldap FROM mgw_users WHERE =
username=3D".$conn->quote($login); if (!$res =3D $conn->Execute($sql)) =
exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__)); $row =
=3D $res->FetchRow(); if ($res->RecordCount()=3D=3D0 and =
(!isset($_SERVER["REMOTE_USER"]) or (isset($_POST["noautologin"]) and =
$_POST["noautologin"]))) { //the username is not present in the database =
// if ($appconf["create_accounts_on_login"]) { //user does not exists, =
but was authentified //lets create an account for this user if =
create_accounts_on_login // is defined in the config =
create_user_account($login); if ($row=3Dget_user_info($login)) $num=3D1; =
} else { //the user is not allow to create a new account =
include(INCLUDEPATH . "mSelectBox.class.inc"); $lsb =3D new =
mSelectBox("language"); $lsb->setContentType("sql"); =
$lsb->setSQLvalue("langcode"); $lsb->setSQLcontent("description"); =
$lsb->addContent("SELECT langcode, description FROM mgw_languages ORDER =
BY description"); $smarty->assign("lsb", $lsb->draw($loginlang, =
'onchange=3D"document.f1.submit()"')); $smarty->assign('loginerrortext', =
getLanguageString("loginerror")); $smarty->display("login.tpl"); exit(); =
} } else { //the user is present in the database if =
($row["is_ldap"]=3D=3D0) { //the user is not an admin and so on =
include(INCLUDEPATH . "Auth/sql.inc"); }else {//he is =
include(INCLUDEPATH ."Auth/". $appconf["auth_method"] . ".inc"); } if =
(!authentify_user($login, $password)) { include(INCLUDEPATH . =
"mSelectBox.class.inc"); $lsb =3D new mSelectBox("language"); =
$lsb->setContentType("sql"); $lsb->setSQLvalue("langcode"); =
$lsb->setSQLcontent("description"); $lsb->addContent("SELECT langcode, =
description FROM mgw_languages ORDER BY description"); =
$smarty->assign("lsb", $lsb->draw($loginlang, =
'onchange=3D"document.f1.submit()"')); $smarty->assign('loginerrortext', =
getLanguageString("loginerror")); $smarty->display("login.tpl"); exit(); =
} if ($row=3Dget_user_info($login)) $num=3D1; } if ($num =3D=3D 1) { // =
Login successfull $_SESSION["checkip"] =3D $_POST["checkip"]; =
$_SESSION["remoteip"] =3D $_SERVER["REMOTE_ADDR"]; if($row["lang"] !=3D =
"login"){ $_SESSION["MGW"]->spkz =3D $row["lang"]; =
$_SESSION["MGW"]->charset =3D $row["charset"]; } else{ =
$_SESSION["MGW"]->spkz =3D $_POST["language"]; $lsql =3D "SELECT charset =
FROM mgw_languages WHERE langcode=3D".$conn->quote($_POST["language"]); =
if (!$lres =3D $conn->Execute($lsql)) exit(showSQLerror($sql, =
$conn->ErrorMsg(), __LINE__, __FILE__)); $lrow =3D $lres->FetchRow(); =
$_SESSION["MGW"]->charset =3D $lrow["charset"]; } =
$_SESSION["MGW"]->fullusername =3D $row["firstname"] . " " . =
$row["lastname"]; $_SESSION["MGW"]->username =3D $row["username"]; =
$_SESSION["MGW"]->userid =3D $row["id"]; $_SESSION["MGW"]->login =3D =
$login; $_SESSION["MGW"]->password =3D $password; =
$_SESSION["MGW"]->modules =3D array(); getInstalledModules(); =
$smarty->assign("charset", $_SESSION["MGW"]->charset); getUserRights(); =
getUserSettings(); =
redirect("modules/".$_SESSION["MGW"]->settings["def_module"]."/index.php?=
".SID); } else if ($num =3D=3D 0) { // Login not successfull =
include(INCLUDEPATH . "mSelectBox.class.inc"); $lsb =3D new =
mSelectBox("language"); $lsb->setContentType("sql"); =
$lsb->setSQLvalue("langcode"); $lsb->setSQLcontent("description"); =
$lsb->addContent("SELECT langcode, description FROM mgw_languages ORDER =
BY description"); $smarty->assign("lsb", $lsb->draw($loginlang, =
'onchange=3D"document.f1.submit()"')); unset($_SESSION['MGW']); =
$smarty->assign('loginerrortext', getLanguageString("loginerror")); =
$smarty->display("login.tpl"); } } ?>
|