Adding pluggable authentication

This commit is contained in:
Martin Kamerbeek 2002-11-18 17:44:14 +00:00
parent d843d50c5f
commit 7af36f0c03
8 changed files with 421 additions and 186 deletions

View file

@ -0,0 +1,35 @@
package WebGUI::Authentication;
use WebGUI::Authentication::LDAP;
use WebGUI::Authentication::WebGUI;
use WebGUI::SQL;
use strict;
sub saveParams {
my ($uid, $authMethod, $data, @values);
($uid, $authMethod, $data) = @_;
foreach (keys(%$data)) {
my $sql = "replace into authentication set userId=$uid, authMethod=".quote($authMethod).", fieldData=".quote($$data{$_}).", fieldName=".quote($_);
WebGUI::SQL->write($sql);
}
}
sub getParams {
my ($uid, $authMethod, $data);
$uid = shift;
$authMethod = shift;
$data = WebGUI::SQL->buildHashRef("select fieldName, fieldData from authentication where userId=$uid and authMethod='$authMethod'");
return $data;
}
sub deleteParams {
my $uid = shift;
if ($uid) {
WebGUI::SQL->write("delete from authentication where userId=$uid");
}
}
1;