Revision history for Webauth


Revision [19429]

Last edited on 2008-01-28 00:15:58 by JavaWoman [Modified links pointing to docs server]

No Differences

Revision [17815]

Edited on 2007-12-12 11:03:17 by JavaWoman [prevent function references looking as page links]
Additions:
Also comment out function ""GetUserName()"" and replace with
Deletions:
Also comment out function GetUserName and replace with


Revision [16311]

Edited on 2007-03-20 06:07:49 by GuyEdwards [found another issue]
Additions:
Still to do: It's not possible to delete a page using /delete - (this may just be me being thick)


Revision [16275]

Edited on 2007-03-09 09:28:01 by GuyEdwards [another problem]
Additions:
Still to do: user settings page has the username wrong


Revision [16274]

Edited on 2007-03-09 09:25:03 by GuyEdwards [added a problem]
Additions:
Still to do: You can edit pages fine, index pages works fine but recent pages says "There are no recently changed pages you have access to"


Revision [16273]

Edited on 2007-03-09 09:20:04 by GuyEdwards [it's alive!]
Additions:
Also comment out function GetUserName and replace with
function GetUserName() { $name=$_SERVER["REMOTE_USER"]; return $name;}
Deletions:
Still to do: It now appears to be recognising that the user is already authenticated (e.g. not asking them to login) however the usernames used by webauth (at this location) aren't valid Wiki Formatted names so a username of deptname01234 appears as "d" in the top right of the wiki page currently.


Revision [16272]

Edited on 2007-03-09 06:12:00 by GuyEdwards [added note about logout process]
Additions:
Still to do: It now appears to be recognising that the user is already authenticated (e.g. not asking them to login) however the usernames used by webauth (at this location) aren't valid Wiki Formatted names so a username of deptname01234 appears as "d" in the top right of the wiki page currently.
Still to do: For "webauth" I also just need to make the logout redirect to a specific url e.g. https://webauth.mycompany.somewhere/logout which will kill the kerberos session.
Deletions:
It now appears to be recognising that the user is already authenticated (e.g. not asking them to login) however the usernames used by webauth (at this location) aren't valid Wiki Formatted names so a username of deptname01234 appears as "d" in the top right of the wiki page currently.


Revision [16271]

Edited on 2007-03-09 05:44:44 by GuyEdwards [updated it to add more explanation]
Additions:
The webauth Apache module, and any other apache authentication module should set $_SERVER[REMOTE_USER] once the user is authenticated.
E.g. to access the wiki directory Apache uses a module you have configured (basic auth via a .htaccess file, or auth via mod_webauth etc) challenges the user for a username and password, I think you will still need a users entry in the database.
It now appears to be recognising that the user is already authenticated (e.g. not asking them to login) however the usernames used by webauth (at this location) aren't valid Wiki Formatted names so a username of deptname01234 appears as "d" in the top right of the wiki page currently.
Deletions:
The webauth Apache module, and any other apache authentication module should set $_SERVER[REMOTE_USER] once the user is authenticated.
It now appears to be authenticating the user however the usernames used by webauth (at this location) aren't valid Wiki Formatted names.


Revision [16270]

Edited on 2007-03-09 05:38:04 by GuyEdwards [updated it to add more explanation]
Additions:
so in approx line 808 in libs/Wakka.class.php
Deletions:
so in
(approx line 808 in libs/Wakka.class.php)


Revision [16269]

Edited on 2007-03-09 05:37:32 by GuyEdwards [Got it working with one remaining issue]
Additions:
The webauth Apache module, and any other apache authentication module should set $_SERVER[REMOTE_USER] once the user is authenticated.
so in
comment out the existing line and replace:
(approx line 808 in libs/Wakka.class.php)
// function GetUser() { return (isset($_SESSION["user"])) ? $_SESSION["user"] : NULL; }
function GetUser() { return (isset($_SERVER["REMOTE_USER"])) ? $_SERVER["REMOTE_USER"] : NULL; }
It now appears to be authenticating the user however the usernames used by webauth (at this location) aren't valid Wiki Formatted names.
Deletions:
(note this is 99% just a copy of the work someone did on the ActiveDirectory authentication, just using the WEBAUTH_USER var instead)
=== Scenario ===
The user has already logged into your apache server after being authenticated by the webauth apache module. As per the ActiveDirectory page you still want to track chages however.
=== pre requisites ===
Working and tested webauth module
=== Solution ===
Working through http://wikkawiki.org/ActiveDirectory and applying the same changes, but in this case we know who the user is through use of another apache module, webauth: http://webauth.stanford.edu/obtain.html
1) Add a new field in the users database:
%%(sql)
ALTER TABLE `wikka_users` ADD `alias` VARCHAR(75) NOT NULL
2) Add the following code in wikka.config.php
%%(php)
"user_identification" => "webauth",
3) In libs/Wakka.class.php about line 985, just after:
%%(php)
// THE BIG EVIL NASTY ONE!
function Run($tag, $method = "")
{
// do our stuff!
if (!$this->method = trim($method)) $this->method = "show";
if (!$this->tag = trim($tag)) $this->Redirect($this->Href("", $this->config["root_page"]));
Add the following code:
%%(php)
// Check if webauth is on and webauth user known
if (($this->config["user_identification"]=="webauth") && (!$this->GetUser()))
{
$idwebauth = $this->GetUserName();
$sql = "SELECT name"
. " FROM ".$this->config["table_prefix"]."users"
. " WHERE alias = '"
. mysql_real_escape_string($idwebauth)
. "' limit 1";
$hisname = $this->LoadSingle($sql);
if ($hisname) {
$this->SetUser($this->LoadUser($hisname["name"]));
}
}
4) In libs/Wakka.class.php on line 806 we modify the function GetUserName() to use the WEBAUTH_USER server variable:
ref: http://www.stanford.edu/services/webauth/manual/mod/mod_webauth.html
%%(php)
function GetUserName() {
if ($user = $this->GetUser()){
//$name = $user["name"];
$name = $_SERVER["WEBAUTH_USER"];
// start of new code
}
else if (!$name = $_SERVER["WEBAUTH_USER"]) {
$name = $_SERVER["WEBAUTH_USER"];
// belts, braces, thermos, survival bag....
$name = trim(htmlentities(strip_tags($name)));
//end of new code
}
else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) {
$name = $_SERVER["REMOTE_ADDR"];
}
return $name;
}
=== How to use it? ===
Added webauth username to the alias field
....not working will try again tomorrow


Revision [16266]

Edited on 2007-03-08 13:10:43 by GuyEdwards [updated my bodged code]
Additions:
function GetUserName() {
if ($user = $this->GetUser()){
//$name = $user["name"];
$name = $_SERVER["WEBAUTH_USER"];
// start of new code
}
else if (!$name = $_SERVER["WEBAUTH_USER"]) {
$name = $_SERVER["WEBAUTH_USER"];
// belts, braces, thermos, survival bag....
$name = trim(htmlentities(strip_tags($name)));
//end of new code
}
else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"])) {
$name = $_SERVER["REMOTE_ADDR"];
}
return $name;
Deletions:
function GetUserName() {
if ($user = $this->GetUser())
$name = $user["name"];
// start of new code
else if (!$name = $_SERVER["WEBAUTH_USER"])
$name = $_SERVER["WEBAUTH_USER"];
// belts, braces, thermos, survival bag....
$name = trim(htmlentities(strip_tags($name)));
//end of new code
else if (!$name = gethostbyaddr($_SERVER["REMOTE_ADDR"]))
$name = $_SERVER["REMOTE_ADDR"];
return $name;


Revision [16253]

Edited on 2007-03-05 17:21:09 by GuyEdwards [minor update]
Additions:
Added webauth username to the alias field
....not working will try again tomorrow
Deletions:
I'm testing it now


Revision [16252]

The oldest known version of this page was created on 2007-03-05 17:03:58 by GuyEdwards [minor update]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki