[Catalyst-commits] r13556 - in Catalyst-Authentication-Store-LDAP/trunk: . lib/Catalyst/Authentication/Store lib/Catalyst/Authentication/Store/LDAP

karpet at dev.catalyst.perl.org karpet at dev.catalyst.perl.org
Sat Aug 28 04:46:57 GMT 2010


Author: karpet
Date: 2010-08-28 05:46:57 +0100 (Sat, 28 Aug 2010)
New Revision: 13556

Modified:
   Catalyst-Authentication-Store-LDAP/trunk/Changes
   Catalyst-Authentication-Store-LDAP/trunk/README
   Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP.pm
   Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/Backend.pm
   Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm
Log:
add documentation for AD; add User methods per RT #60793

Modified: Catalyst-Authentication-Store-LDAP/trunk/Changes
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/Changes	2010-08-27 23:07:41 UTC (rev 13555)
+++ Catalyst-Authentication-Store-LDAP/trunk/Changes	2010-08-28 04:46:57 UTC (rev 13556)
@@ -1,3 +1,10 @@
+1.012  xxx
+  - add methods conforming to the Catalyst::Authentication::User API
+    as required here: 
+    http://search.cpan.org/dist/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Internals.pod#USER_METHODS
+    Nudging provided via RT https://rt.cpan.org/Ticket/Display.html?id=60793
+  - add documentation for Active Directory at suggestion of Adam Wohld
+
 1.011  7 July 2010
   - fix t/05-user_attributes.t to skip correct number of tests if
     Catalyst::Model::LDAP is not installed.

Modified: Catalyst-Authentication-Store-LDAP/trunk/README
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/README	2010-08-27 23:07:41 UTC (rev 13555)
+++ Catalyst-Authentication-Store-LDAP/trunk/README	2010-08-28 04:46:57 UTC (rev 13556)
@@ -37,7 +37,7 @@
                    user_basedn         => "ou=people,dc=yourcompany,dc=com",
                    user_field          => "uid",
                    user_filter         => "(&(objectClass=posixAccount)(uid=%s))",
-                   user_scope          => "one",
+                   user_scope          => "one", # or "sub" for Active Directory
                    user_search_options => { deref => "always" },
                    user_results_filter => sub { return shift->pop_entry },
                  },
@@ -131,7 +131,8 @@
 
         user_basedn: ou=Domain Users,ou=Accounts,dc=mycompany,dc=com
         user_field:  samaccountname
-        user_filter: (sAMAccountName=%s)
+        user_filter: (sAMAccountName=%s) 
+        user_scope: sub
 
     He also notes: "I found the case in the value of user_field to be
     significant: it didn't seem to work when I had the mixed case value
@@ -220,7 +221,7 @@
                               }
                               return undef; # i.e., no match
                             }
-
+ 
   use_roles
     Whether or not to enable role lookups. It defaults to true; set it to 0
     if you want to always avoid role lookups.

Modified: Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/Backend.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/Backend.pm	2010-08-27 23:07:41 UTC (rev 13555)
+++ Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/Backend.pm	2010-08-28 04:46:57 UTC (rev 13556)
@@ -31,7 +31,7 @@
             },
             'user_basedn' => 'ou=people,dc=yourcompany,dc=com',
             'user_filter' => '(&(objectClass=posixAccount)(uid=%s))',
-            'user_scope' => 'one',
+            'user_scope' => 'one',  # or 'sub' for Active Directory
             'user_field' => 'uid',
             'user_search_options' => {
                 'deref' => 'always',
@@ -72,7 +72,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.011';
+our $VERSION = '1.012';
 
 use Catalyst::Authentication::Store::LDAP::User;
 use Net::LDAP;

Modified: Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm	2010-08-27 23:07:41 UTC (rev 13555)
+++ Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm	2010-08-28 04:46:57 UTC (rev 13556)
@@ -50,7 +50,7 @@
 use warnings;
 use Scalar::Util qw/refaddr/;
 
-our $VERSION = '1.011';
+our $VERSION = '1.012';
 
 BEGIN { __PACKAGE__->mk_accessors(qw/user store/) }
 
@@ -239,6 +239,23 @@
     }
 }
 
+=head2 get
+
+A simple wrapper around has_attribute() to satisfy the Catalyst::Authentication::User API.
+
+=cut
+
+sub get { return shift->has_attribute(@_) }
+
+=head2 get_object
+
+Satisfies the Catalyst::Authentication::User API and returns the contents of the user()
+attribute.
+
+=cut
+
+sub get_object { return shift->user }
+
 =head2 ldap_connection
 
 Re-binds to the auth store with the credentials of the user you logged in

Modified: Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP.pm	2010-08-27 23:07:41 UTC (rev 13555)
+++ Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP.pm	2010-08-28 04:46:57 UTC (rev 13556)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-our $VERSION = '1.011';
+our $VERSION = '1.012';
 
 use Catalyst::Authentication::Store::LDAP::Backend;
 
@@ -60,7 +60,7 @@
                user_basedn         => "ou=people,dc=yourcompany,dc=com",
                user_field          => "uid",
                user_filter         => "(&(objectClass=posixAccount)(uid=%s))",
-               user_scope          => "one",
+               user_scope          => "one", # or "sub" for Active Directory
                user_search_options => { deref => "always" },
                user_results_filter => sub { return shift->pop_entry },
              },
@@ -156,6 +156,7 @@
     user_basedn: ou=Domain Users,ou=Accounts,dc=mycompany,dc=com
     user_field:  samaccountname
     user_filter: (sAMAccountName=%s) 
+    user_scope: sub
 
 He also notes: "I found the case in the value of user_field to be significant: 
 it didn't seem to work when I had the mixed case value there."




More information about the Catalyst-commits mailing list