[Jifty-commit] r2172 - in jifty/trunk/plugins: AuthLDAPLogin
AuthLDAPLogin/debian AuthLDAPLogin/lib/Jifty/Plugin
AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin/Action
AuthLDAPLogin/share/po AuthLDAPOnly AuthLDAPOnly/debian
AuthLDAPOnly/lib/Jifty/Plugin
AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly
AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model
AuthLDAPOnly/share/po
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Nov 17 05:22:40 EST 2006
Author: yves
Date: Fri Nov 17 05:22:39 2006
New Revision: 2172
Added:
jifty/trunk/plugins/AuthLDAPLogin/debian/
jifty/trunk/plugins/AuthLDAPLogin/debian/changelog
jifty/trunk/plugins/AuthLDAPLogin/debian/compat
jifty/trunk/plugins/AuthLDAPLogin/debian/control
jifty/trunk/plugins/AuthLDAPLogin/debian/copyright
jifty/trunk/plugins/AuthLDAPLogin/debian/rules (contents, props changed)
jifty/trunk/plugins/AuthLDAPLogin/share/po/en.po
jifty/trunk/plugins/AuthLDAPLogin/share/po/fr.po
jifty/trunk/plugins/AuthLDAPOnly/debian/
jifty/trunk/plugins/AuthLDAPOnly/debian/changelog
jifty/trunk/plugins/AuthLDAPOnly/debian/compat
jifty/trunk/plugins/AuthLDAPOnly/debian/control
jifty/trunk/plugins/AuthLDAPOnly/debian/copyright
jifty/trunk/plugins/AuthLDAPOnly/debian/rules (contents, props changed)
jifty/trunk/plugins/AuthLDAPOnly/share/po/en.po
jifty/trunk/plugins/AuthLDAPOnly/share/po/fr.po
Modified:
jifty/trunk/plugins/AuthLDAPLogin/MANIFEST
jifty/trunk/plugins/AuthLDAPLogin/Makefile.PL
jifty/trunk/plugins/AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin.pm
jifty/trunk/plugins/AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm
jifty/trunk/plugins/AuthLDAPOnly/MANIFEST
jifty/trunk/plugins/AuthLDAPOnly/Makefile.PL
jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly.pm
jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm
jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/CurrentUser.pm
jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm
Log:
code cleanup, add doc,
take care I changed LDAPserver by LDAPhost to respect Net::LDAP name
Modified: jifty/trunk/plugins/AuthLDAPLogin/MANIFEST
==============================================================================
--- jifty/trunk/plugins/AuthLDAPLogin/MANIFEST (original)
+++ jifty/trunk/plugins/AuthLDAPLogin/MANIFEST Fri Nov 17 05:22:39 2006
@@ -1,18 +1,15 @@
-inc/Module/Install.pm
-inc/Module/Install/Base.pm
-inc/Module/Install/Can.pm
-inc/Module/Install/Fetch.pm
-inc/Module/Install/Makefile.pm
-inc/Module/Install/Metadata.pm
-inc/Module/Install/Share.pm
-inc/Module/Install/Win32.pm
-inc/Module/Install/WriteAll.pm
+debian/changelog
+debian/compat
+debian/control
+debian/copyright
+debian/rules
lib/Jifty/Plugin/AuthLDAPLogin.pm
lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm
lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogout.pm
lib/Jifty/Plugin/AuthLDAPLogin/Dispatcher.pm
Makefile.PL
MANIFEST
-META.yml
+share/po/en.po
+share/po/fr.po
share/web/templates/ldaplogin
share/web/templates/ldaplogout
Modified: jifty/trunk/plugins/AuthLDAPLogin/Makefile.PL
==============================================================================
--- jifty/trunk/plugins/AuthLDAPLogin/Makefile.PL (original)
+++ jifty/trunk/plugins/AuthLDAPLogin/Makefile.PL Fri Nov 17 05:22:39 2006
@@ -3,6 +3,7 @@
license('Perl');
version('0.01');
requires('Jifty' => '0.60912');
+requires('Jifty::Plugin::Login');
requires('Net::LDAP');
install_share;
Added: jifty/trunk/plugins/AuthLDAPLogin/debian/changelog
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPLogin/debian/changelog Fri Nov 17 05:22:39 2006
@@ -0,0 +1,6 @@
+libjifty-plugin-authldaplogin-perl (0-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- AGOSTINI Yves <agostini at univ-metz.fr> Fri, 17 Nov 2006 09:52:24 +0100
+
Added: jifty/trunk/plugins/AuthLDAPLogin/debian/compat
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPLogin/debian/compat Fri Nov 17 05:22:39 2006
@@ -0,0 +1 @@
+4
Added: jifty/trunk/plugins/AuthLDAPLogin/debian/control
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPLogin/debian/control Fri Nov 17 05:22:39 2006
@@ -0,0 +1,19 @@
+Source: libjifty-plugin-authldaplogin-perl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 4.0.2)
+Build-Depends-Indep: perl (>= 5.8.0-7)
+Maintainer: AGOSTINI Yves <agostini at univ-metz.fr>
+Standards-Version: 3.6.1
+
+Package: libjifty-plugin-authldaplogin-perl
+Architecture: all
+Depends: ${perl:Depends}, ${misc:Depends}, libjifty-plugin-login-perl,
+ libnet-ldap
+Description: Jifty::Plugin::AuthLDAPLogin
+ MUST BE USED WITH Login PLUGIN.
+ .
+ Add ldap users in Jifty::Plugin::Login::Model::User.
+ Distinct id for ldap users is email field with login at LDAP.user
+ .
+ This description was automagically extracted from the module by dh-make-perl.
Added: jifty/trunk/plugins/AuthLDAPLogin/debian/copyright
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPLogin/debian/copyright Fri Nov 17 05:22:39 2006
@@ -0,0 +1,7 @@
+This is the debian package for the module.
+It was created by AGOSTINI Yves <agostini at univ-metz.fr> using dh-make-perl.
+
+This copyright info was automatically extracted from the perl module.
+It may not be accurate, so you better check the module sources
+if don't want to get into legal troubles.
+
Added: jifty/trunk/plugins/AuthLDAPLogin/debian/rules
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPLogin/debian/rules Fri Nov 17 05:22:39 2006
@@ -0,0 +1,83 @@
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PACKAGE=$(shell dh_listpackages)
+
+ifndef PERL
+PERL = /usr/bin/perl
+endif
+
+TMP =$(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+
+ # Add commands to compile the package here
+ $(PERL) Makefile.PL INSTALLDIRS=vendor
+ $(MAKE) OPTIMIZE="-Wall -O2 -g"
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+
+ # Add commands to clean up after the build process here
+ -$(MAKE) distclean
+
+ dh_clean build-stamp install-stamp
+
+install: build install-stamp
+install-stamp:
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+
+ # Add commands to install the package into debian/$PACKAGE_NAME here
+ $(MAKE) test
+ $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+
+ # As this is a architecture independent package, we are not
+ # supposed to install stuff to /usr/lib. MakeMaker creates
+ # the dirs, we delete them from the deb:
+ rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/lib/perl5
+
+ touch install-stamp
+
+binary-arch:
+# We have nothing to do by default.
+
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+# dh_installcron
+# dh_installmenu
+# dh_installexamples
+ dh_installdocs
+ dh_installchangelogs
+ dh_perl
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
Modified: jifty/trunk/plugins/AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin.pm
==============================================================================
--- jifty/trunk/plugins/AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin.pm (original)
+++ jifty/trunk/plugins/AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin.pm Fri Nov 17 05:22:39 2006
@@ -3,24 +3,29 @@
=head1 NAME
- Jifty::Plugin::AuthLDAPLogin
+Jifty::Plugin::AuthLDAPLogin
=head1 DESCRIPTION
- MUST BE USED WITH LOGIN PLUGIN
+B<MUST BE USED WITH Login PLUGIN.>
+
+Add ldap users in L<Jifty::Plugin::Login::Model::User>.
+Distinct id for ldap users is C<email> field with C<login at LDAP.user>
=head1 CONFIG
- in etc/config.yml
+in etc/config.yml
Plugins:
- Login: {}
- AuthLDAPLogin:
- LDAPserver: ldap.univ.fr
- LDAPbase: ou=people,dc=.....
- LDAPuid: uid
- LDAPemail: mailLocalAddress
+ LDAPhost: ldap.univ.fr # ldap server
+ LDAPbase: ou=people,dc=..... # base ldap
+ LDAPuid: uid # optional
+
+=head1 SEE ALSO
+L<Net::LDAP>
=cut
@@ -43,15 +48,10 @@
$AuthLDAPUserClass = $args{AuthLDAPUserClass}
|| "${appname}::Model::LDAPUser";
- my ($conf);
- foreach (@{Jifty->config->framework('Plugins')}) {
- $conf = $_ if (defined $_->{'AuthLDAPLogin'});
- }
- $params{'Hostname'} = $conf->{'AuthLDAPLogin'}->{'LDAPserver'};
- $params{'base'} = $conf->{'AuthLDAPLogin'}->{'LDAPbase'};
- $params{'uid'} = $conf->{'AuthLDAPLogin'}->{'LDAPuid'};
- $params{'email'} = $conf->{'AuthLDAPLogin'}->{'LDAPemail'};
- $LDAP = Net::LDAP->new($params{Hostname},async=>1,onerror => 'undef',timeout => 3600, debug => 0);
+ $params{'Hostname'} = $args{LDAPhost};
+ $params{'base'} = $args{LDAPbase};
+ $params{'uid'} = $args{LDAPuid} || "uid";
+ $LDAP = Net::LDAP->new($params{Hostname},async=>1,onerror => 'undef', debug => 0);
}
sub CurrentLDAPUserClass {
@@ -74,9 +74,6 @@
return $params{'uid'};
}
- sub email {
- return $params{'email'};
- }
}
1;
Modified: jifty/trunk/plugins/AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm
==============================================================================
--- jifty/trunk/plugins/AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm (original)
+++ jifty/trunk/plugins/AuthLDAPLogin/lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm Fri Nov 17 05:22:39 2006
@@ -13,7 +13,7 @@
=head2 arguments
-Return the ticket form field
+Return the login form field
=cut
@@ -37,10 +37,10 @@
}
-=head2 validate_ticket ST
+=head2 validate_name NAME
-for ajax_validates
-Makes sure that the ticket submitted is legal.
+For ajax_validates.
+Makes sure that the name submitted is a legal login.
=cut
@@ -61,7 +61,7 @@
=head2 take_action
-Actually check the user's password. If it's right, log them in.
+Bind on ldap to check the user's password. If it's right, log them in.
Otherwise, throw an error.
@@ -73,6 +73,7 @@
my $dn = $self->uid().'='.$username.','.
$self->base();
+ # Bind on ldap
my $msg = $self->LDAP()->bind($dn ,'password' =>$self->argument_value('password'));
unless (not $msg->code) {
@@ -82,19 +83,16 @@
return;
}
-# if ($error) {
-# Jifty->log->info("CAS error: $ticket $username : $error");
-# return;
-# }
-
my $LDAPUser = $self->LoginUserClass();
my $CurrentUser = $self->CurrentUserClass();
my $u = $LDAPUser->new( current_user => $CurrentUser->superuser );
+ # Distinct id is login at LDAP.user
+ # Add user to User Login model
$u->load_by_cols( email => $username.'@LDAP.user');
my $id = $u->id;
if (!$id) {
- ($id) = $u->create(name => $username, email => $username.'@LDAP.user');
+ ($id) = $u->create(name => $username, email => $username.'@LDAP.user');
}
Jifty->log->debug("Login user id: $id");
Added: jifty/trunk/plugins/AuthLDAPLogin/share/po/en.po
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPLogin/share/po/en.po Fri Nov 17 05:22:39 2006
@@ -0,0 +1,25 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm:54
+msgid "That doesn't look like a valid login."
+msgstr ""
+
+#: lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm:81
+msgid "You may have mistyped your login or password. Give it another shot?"
+msgstr ""
+
Added: jifty/trunk/plugins/AuthLDAPLogin/share/po/fr.po
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPLogin/share/po/fr.po Fri Nov 17 05:22:39 2006
@@ -0,0 +1,25 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2006-11-17 10:23+ZONE\n"
+"PO-Revision-Date: 2006-11-17 10:23+ZONE\n"
+"Last-Translator: Yves Agostini <agostini at univ-metz.fr>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO8859-15\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm:54
+msgid "That doesn't look like a valid login."
+msgstr "Cet identifiant ne semble pas valide."
+
+#: lib/Jifty/Plugin/AuthLDAPLogin/Action/LDAPLogin.pm:81
+msgid "You may have mistyped your login or password. Give it another shot?"
+msgstr "Erreur dans votre identifiant ou votre mot de passe. Ré-essayez."
+
Modified: jifty/trunk/plugins/AuthLDAPOnly/MANIFEST
==============================================================================
--- jifty/trunk/plugins/AuthLDAPOnly/MANIFEST (original)
+++ jifty/trunk/plugins/AuthLDAPOnly/MANIFEST Fri Nov 17 05:22:39 2006
@@ -1,4 +1,3 @@
-MANIFEST
lib/Jifty/Plugin/AuthLDAPOnly.pm
lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm
lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogout.pm
@@ -6,5 +5,8 @@
lib/Jifty/Plugin/AuthLDAPOnly/Dispatcher.pm
lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm
Makefile.PL
+MANIFEST
+share/po/en.po
+share/po/fr.po
share/web/templates/ldaplogin
share/web/templates/ldaplogout
Modified: jifty/trunk/plugins/AuthLDAPOnly/Makefile.PL
==============================================================================
--- jifty/trunk/plugins/AuthLDAPOnly/Makefile.PL (original)
+++ jifty/trunk/plugins/AuthLDAPOnly/Makefile.PL Fri Nov 17 05:22:39 2006
@@ -3,6 +3,7 @@
license('Perl');
version('0.01');
requires('Jifty' => '0.60912');
+requires('Scalar::Defer');
requires('Net::LDAP');
install_share;
Added: jifty/trunk/plugins/AuthLDAPOnly/debian/changelog
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPOnly/debian/changelog Fri Nov 17 05:22:39 2006
@@ -0,0 +1,6 @@
+libjifty-plugin-authldaponly-perl (0-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- AGOSTINI Yves <agostini at univ-metz.fr> Fri, 17 Nov 2006 11:10:53 +0100
+
Added: jifty/trunk/plugins/AuthLDAPOnly/debian/compat
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPOnly/debian/compat Fri Nov 17 05:22:39 2006
@@ -0,0 +1 @@
+4
Added: jifty/trunk/plugins/AuthLDAPOnly/debian/control
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPOnly/debian/control Fri Nov 17 05:22:39 2006
@@ -0,0 +1,19 @@
+Source: libjifty-plugin-authldaponly-perl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 4.0.2)
+Build-Depends-Indep: perl (>= 5.8.0-7)
+Maintainer: AGOSTINI Yves <agostini at univ-metz.fr>
+Standards-Version: 3.6.1
+
+Package: libjifty-plugin-authldaponly-perl
+Architecture: all
+Depends: ${perl:Depends}, ${misc:Depends}, libjifty-perl, libnet-ldap-perl
+Description: Jifty::Plugin::AuthLDAPOnly
+ MUST NOT BE USED WITH Login PLUGIN
+ .
+ Provide authentication: only for users in your ldap.
+ .
+ If you need external users see Jifty::Plugin::AuthLDAPLogin
+ .
+ This description was automagically extracted from the module by dh-make-perl.
Added: jifty/trunk/plugins/AuthLDAPOnly/debian/copyright
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPOnly/debian/copyright Fri Nov 17 05:22:39 2006
@@ -0,0 +1,7 @@
+This is the debian package for the module.
+It was created by AGOSTINI Yves <agostini at univ-metz.fr> using dh-make-perl.
+
+This copyright info was automatically extracted from the perl module.
+It may not be accurate, so you better check the module sources
+if don't want to get into legal troubles.
+
Added: jifty/trunk/plugins/AuthLDAPOnly/debian/rules
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPOnly/debian/rules Fri Nov 17 05:22:39 2006
@@ -0,0 +1,83 @@
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PACKAGE=$(shell dh_listpackages)
+
+ifndef PERL
+PERL = /usr/bin/perl
+endif
+
+TMP =$(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+
+ # Add commands to compile the package here
+ $(PERL) Makefile.PL INSTALLDIRS=vendor
+ $(MAKE) OPTIMIZE="-Wall -O2 -g"
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+
+ # Add commands to clean up after the build process here
+ -$(MAKE) distclean
+
+ dh_clean build-stamp install-stamp
+
+install: build install-stamp
+install-stamp:
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+
+ # Add commands to install the package into debian/$PACKAGE_NAME here
+ $(MAKE) test
+ $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+
+ # As this is a architecture independent package, we are not
+ # supposed to install stuff to /usr/lib. MakeMaker creates
+ # the dirs, we delete them from the deb:
+ rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/lib/perl5
+
+ touch install-stamp
+
+binary-arch:
+# We have nothing to do by default.
+
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+# dh_installcron
+# dh_installmenu
+# dh_installexamples
+ dh_installdocs
+ dh_installchangelogs
+ dh_perl
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
Modified: jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly.pm
==============================================================================
--- jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly.pm (original)
+++ jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly.pm Fri Nov 17 05:22:39 2006
@@ -3,22 +3,31 @@
=head1 NAME
- Jifty::Plugin::AuthLDAPOnly
+Jifty::Plugin::AuthLDAPOnly
=head1 DESCRIPTION
- MUST NOT BE USED WITH LOGIN PLUGIN
+B<MUST NOT BE USED WITH Login PLUGIN>
+
+Provide authentication: only for users in your ldap.
+
+If you need external users see C<Jifty::Plugin::AuthLDAPLogin>
=head1 CONFIG
- in etc/config.yml
+in etc/config.yml
Plugins:
- AuthLDAPOnly:
- LDAPserver: ldap1.univ-metz.fr
- LDAPbase: ou=people, ou=...
- LDAPuid: uid
- LDAPemail: mailLocalAddress
-
+ LDAPhost: ldap1.univ-metz.fr # ldap host
+ LDAPbase: ou=people, ou=... # ldap base
+ LDAPuid: uid # optional
+
+in your user model
+ use base qw/Jifty::Plugin::AuthLDAPOnly::Model::LDAPUser/;
+
+=head1 SEE ALSO
+
+L<Net::LDAP>
=cut
@@ -41,16 +50,10 @@
$AuthLDAPUserClass = $args{AuthLDAPUserClass}
|| "${appname}::Model::LDAPUser";
- my ($conf);
- foreach (@{Jifty->config->framework('Plugins')}) {
- $conf = $_ if (defined $_->{'AuthLDAPOnly'});
- }
- $params{'Hostname'} = $conf->{'AuthLDAPOnly'}->{'LDAPserver'};
- $params{'base'} = $conf->{'AuthLDAPOnly'}->{'LDAPbase'};
- $params{'uid'} = $conf->{'AuthLDAPOnly'}->{'LDAPuid'};
- $params{'email'} = $conf->{'AuthLDAPOnly'}->{'LDAPemail'};
- $LDAP = Net::LDAP->new($params{Hostname},async=>1,onerror => 'undef',timeout => 3600, debug => 0);
- #my $msg = $LDAP->bind($params{DN},password => $params{Passwd});
+ $params{'Hostname'} = $args{LDAPhost};
+ $params{'base'} = $args{LDAPbase};
+ $params{'uid'} = $args{LDAPuid} || "uid";
+ $LDAP = Net::LDAP->new($params{Hostname},async=>1,onerror => 'undef', debug => 0);
}
sub CurrentLDAPUserClass {
@@ -73,9 +76,6 @@
return $params{'uid'};
}
- sub email {
- return $params{'email'};
- }
}
1;
Modified: jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm
==============================================================================
--- jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm (original)
+++ jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm Fri Nov 17 05:22:39 2006
@@ -9,7 +9,6 @@
package Jifty::Plugin::AuthLDAPOnly::Action::LDAPLogin;
use base qw/Jifty::Action Jifty::Plugin::AuthLDAPOnly/;
-#use AuthCAS;
=head2 arguments
@@ -38,10 +37,10 @@
}
-=head2 validate_ticket ST
+=head2 validate_name NAME
-for ajax_validates
-Makes sure that the ticket submitted is legal.
+For ajax_validates.
+Makes sure that the name submitted is a legal login.
=cut
@@ -62,7 +61,7 @@
=head2 take_action
-Actually check the user's password. If it's right, log them in.
+Bind on ldap to check the user's password. If it's right, log them in.
Otherwise, throw an error.
@@ -73,6 +72,7 @@
my $dn = $self->uid().'='.$self->argument_value('name').','.
$self->base();
+ # Bind on ldap
my $msg = $self->LDAP()->bind($dn ,'password' =>$self->argument_value('password'));
unless (not $msg->code) {
@@ -82,15 +82,11 @@
return;
}
-# if ($error) {
-# Jifty->log->info("CAS error: $ticket $username : $error");
-# return;
-# }
-
my $LDAPUser = $self->AuthLDAPUserClass();
my $CurrentUser = $self->CurrentLDAPUserClass();
my $u = $LDAPUser->new( current_user => $CurrentUser->superuser );
+ # Add user to LDAPUser model
$u->load_by_cols( name => $self->argument_value('name'));
my $id = $u->id;
if (!$id) {
Modified: jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/CurrentUser.pm
==============================================================================
--- jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/CurrentUser.pm (original)
+++ jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/CurrentUser.pm Fri Nov 17 05:22:39 2006
@@ -10,7 +10,7 @@
Instantiate a new current user object, loading the user by paramhash:
- my $item = Jifty::Plugin::AuthLDAPOnly::Model::Item->new( Jifty::Plugin::AuthCASOnly::CurrentUser->new(name => 'user'));
+ my $item = Jifty::Plugin::AuthLDAPOnly::Model::Item->new( Jifty::Plugin::AuthCASOnly::CurrentUser->new(email => 'user at LDAP.user'));
if you give the param
_bootstrap => 1
Modified: jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm
==============================================================================
--- jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm (original)
+++ jifty/trunk/plugins/AuthLDAPOnly/lib/Jifty/Plugin/AuthLDAPOnly/Model/LDAPUser.pm Fri Nov 17 05:22:39 2006
@@ -59,7 +59,6 @@
}
elsif ( $right eq 'update'
and $self->id == $self->current_user->id
-# and $args{'column'} ne 'email_confirmed'
)
{
return (1);
Added: jifty/trunk/plugins/AuthLDAPOnly/share/po/en.po
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPOnly/share/po/en.po Fri Nov 17 05:22:39 2006
@@ -0,0 +1,40 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm:24 share/web/templates/ldaplogin:13 share/web/templates/ldaplogin:8
+msgid "Login"
+msgstr ""
+
+#: share/web/templates/ldaplogout:2
+msgid "Ok, you're now logged out. Have a good day."
+msgstr ""
+
+#: lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm:31
+msgid "Password"
+msgstr ""
+
+#: lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm:54
+msgid "That doesn't look like a valid login."
+msgstr ""
+
+#: lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm:80
+msgid "You may have mistyped your login or password. Give it another shot?"
+msgstr ""
+
+#: share/web/templates/ldaplogin:17
+msgid "You're already logged in."
+msgstr ""
Added: jifty/trunk/plugins/AuthLDAPOnly/share/po/fr.po
==============================================================================
--- (empty file)
+++ jifty/trunk/plugins/AuthLDAPOnly/share/po/fr.po Fri Nov 17 05:22:39 2006
@@ -0,0 +1,25 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL at ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: LANGUAGE <LL at li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO8859-15\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm:54
+msgid "That doesn't look like a valid login."
+msgstr "Cet identifiant ne semble pas valide."
+
+#: lib/Jifty/Plugin/AuthLDAPOnly/Action/LDAPLogin.pm:80
+msgid "You may have mistyped your login or password. Give it another shot?"
+msgstr "Erreur dans votre identifiant ou votre mot de passe. Ré-essayez."
+
More information about the Jifty-commit
mailing list