[Bps-public-commit] r16708 - in RT-Authen-ExternalAuth/trunk: html/Callbacks/ExternalAuth/autohandler lib/RT/Authen
zordrak at bestpractical.com
zordrak at bestpractical.com
Thu Nov 6 11:14:44 EST 2008
Author: zordrak
Date: Thu Nov 6 11:14:43 2008
New Revision: 16708
Modified:
RT-Authen-ExternalAuth/trunk/html/Callbacks/ExternalAuth/autohandler/Auth
RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth.pm
RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth/DBI.pm
RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth/LDAP.pm
Log:
RT::Authen::ExternalAuth -- committing to transfer
Modified: RT-Authen-ExternalAuth/trunk/html/Callbacks/ExternalAuth/autohandler/Auth
==============================================================================
--- RT-Authen-ExternalAuth/trunk/html/Callbacks/ExternalAuth/autohandler/Auth (original)
+++ RT-Authen-ExternalAuth/trunk/html/Callbacks/ExternalAuth/autohandler/Auth Thu Nov 6 11:14:43 2008
@@ -37,7 +37,7 @@
my $UserObj = RT::User->new($RT::SystemUser);
my ($val, $ret, $msg);
# Check if user exists externally - autocreate user if it does
- if(RT::Authen::ExternalAuth->UserExists($user)){
+ if(RT::Authen::ExternalAuth::UserExists($user)){
($val, $msg) =
$UserObj->Create(%{ref($RT::AutoCreate) ? $RT::AutoCreate : {}},
Name => $user,
@@ -54,13 +54,15 @@
")");
($val, $msg) = $UserObj->SetName($user);
-
+ $RT::Logger->debug("Set Name result: Val:",$val,"Msg:",$msg);
# If a password was given on the login page, validate it
if (defined($pass)) {
+ $RT::Logger->debug("\$pass defined ($pass), Running IsPassword");
$password_validated = $UserObj->IsPassword($pass);
}
if($password_validated) {
+$RT::Logger->debug("Pass validated");
if ($UserObj->Id) {
($ret, $msg) = $session{'CurrentUser'}->Load($user);
unless ($ret) {
@@ -81,7 +83,7 @@
# the database, but more importantly, UpdateFromExternal will check
# whether the user is disabled or not which we have not been able to
# do during auto-create
- my ($updated,$update_msg) = RT::Authen::ExternalAuth->UpdateUserInfo($session{'CurrentUser'}->UserObj->Name);
+ my ($updated,$update_msg) = RT::Authen::ExternalAuth::UpdateUserInfo($session{'CurrentUser'}->UserObj->Name);
# Now that we definitely have up-to-date user information,
# if the user is disabled, kick them out. Now!
Modified: RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth.pm
==============================================================================
--- RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth.pm (original)
+++ RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth.pm Thu Nov 6 11:14:43 2008
@@ -22,11 +22,12 @@
ok(require RT::Authen::ExternalAuth::DBI);
=end testing
-
+
+=cut
+
use RT::Authen::ExternalAuth::LDAP;
use RT::Authen::ExternalAuth::DBI;
-
-=cut
+use Data::Dumper;
sub UpdateUserInfo {
my $username = shift;
@@ -109,20 +110,26 @@
sub UserExists {
+ my $self = shift;
my $username = shift;
my $user_exists_externally = 0;
my @auth_services = @$RT::ExternalAuthPriority;
+$RT::Logger->debug("auth_services:",Dumper(@auth_services));
foreach my $service (@auth_services) {
- my $config = $RT::Settings->{$service};
+ my $config = $RT::ExternalSettings->{$service};
+$RT::Logger->debug("config:",Dumper($config));
if ($config->{'type'} eq 'db') {
- $user_exists_externally = RT::Authen::ExternalAuth::DBI->UserExists($service,$user);
+ $user_exists_externally = RT::Authen::ExternalAuth::DBI->UserExists($service,$username);
last if $user_exists_externally;
} elsif ($config->{'type'} eq 'ldap') {
- $user_exists_externally = RT::Authen::ExternalAuth::LDAP->UserExists($service,$user);
+ $user_exists_externally = RT::Authen::ExternalAuth::LDAP->UserExists($service,$username);
last if $user_exists_externally;
} else {
- $RT::Logger->error("Invalid type specification in config for service:",$service);
+ $RT::Logger->error("Invalid type specification (",
+ $config->{'type'},
+ ") in config for service:",
+ $service);
}
}
Modified: RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth/DBI.pm
==============================================================================
--- RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth/DBI.pm (original)
+++ RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth/DBI.pm Thu Nov 6 11:14:43 2008
@@ -143,7 +143,7 @@
# Uncomment this to trace basic DBI throughput in a log
# DBI->trace(1,'/tmp/dbi.log');
- my $dbh = $self->_GetBoundDBIObj($config);
+ my $dbh = _GetBoundDBIObj($config);
my $results_hashref = $dbh->selectall_hashref($query,$key,{}, at bind_params);
$dbh->disconnect();
@@ -199,7 +199,7 @@
# DBI->trace(1,'/tmp/dbi.log');
# Get DBI Object, do the query, disconnect
- my $dbh = $self->_GetBoundDBIObj($config);
+ my $dbh = _GetBoundDBIObj($config);
my $results_hashref = $dbh->selectall_hashref($query,$u_field,{}, at bind_params);
$dbh->disconnect();
@@ -259,7 +259,7 @@
# DBI->trace(1,'/tmp/dbi.log');
# Get DBI Object, do the query, disconnect
- my $dbh = $self->_GetBoundDBIObj($config);
+ my $dbh = _GetBoundDBIObj($config);
my $results_hashref = $dbh->selectall_hashref($query,$u_field,{}, at bind_params);
$dbh->disconnect();
Modified: RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth/LDAP.pm
==============================================================================
--- RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth/LDAP.pm (original)
+++ RT-Authen-ExternalAuth/trunk/lib/RT/Authen/ExternalAuth/LDAP.pm Thu Nov 6 11:14:43 2008
@@ -2,6 +2,7 @@
use Net::LDAP qw(LDAP_SUCCESS LDAP_PARTIAL_RESULTS);
use Net::LDAP::Util qw(ldap_error_name);
use Net::LDAP::Filter;
+use Data::Dumper;
require Net::SSLeay if $RT::ExternalServiceUsesSSLorTLS;
sub GetAuth {
@@ -181,7 +182,7 @@
}
# Get a Net::LDAP object based on the config we provide
- my $ldap = $self->_GetBoundLdapObj($config);
+ my $ldap = _GetBoundLdapObj($config);
# Jump to the next external information service if we can't get one,
# errors should be logged by _GetBoundLdapObj so we don't have to.
@@ -266,8 +267,8 @@
}
sub UserExists {
-
- my ($username,$service) = @_;
+ my ($self,$called_by,$service,$username) = @_;
+ $RT::Logger->debug("UserExists params:\nself: $self , called_by: $called_by , service: $service , username: $username");
my $config = $RT::ExternalSettings->{$service};
my $base = $config->{'base'};
@@ -291,7 +292,7 @@
);
}
- my $ldap = $self->_GetBoundLdapObj($config);
+ my $ldap = _GetBoundLdapObj($config);
next unless $ldap;
my @attrs = values(%{$config->{'attr_map'}});
@@ -384,7 +385,7 @@
}
- my $ldap = $self->_GetBoundLdapObj($config);
+ my $ldap = _GetBoundLdapObj($config);
next unless $ldap;
# We only need the UID for confirmation now,
More information about the Bps-public-commit
mailing list