Adding pluggable authentication
This commit is contained in:
parent
d843d50c5f
commit
7af36f0c03
8 changed files with 421 additions and 186 deletions
35
lib/WebGUI/Authentication.pm
Normal file
35
lib/WebGUI/Authentication.pm
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue