| Catalyst::Plugin::Authentication::Store::LDAP::User |
check_password($password)attributes($type)
Catalyst::Plugin::Authentication::Store::LDAP::User - A User object representing an LDAP object **DEPRECATED**
You should be creating these objects through the Catalyst::Plugin::Authentication::Store::LDAP::Backend manpage's "get_user" method, or just letting $c->login do it for you.
sub action : Local {
my ( $self, $c ) = @_;
$c->login($c->req->param(username), $c->req->param(password));
$c->log->debug($c->user->username . "is really neat!");
}
If you access just $c->user in a scalar context, it will return the current username.
This module is deprecated. Please use the Catalyst::Authentication::Store::LDAP manpage instead.
This wraps up an LDAP object and presents a simplified interface to it's contents. It uses some AUTOLOAD magic to pass method calls it doesn't understand through as simple read only accessors for the LDAP entries various attributes.
It gets grumpy if you ask for an attribute via the AUTOLOAD mechanism that it doesn't know about. Avoid that with using "has_attribute", discussed in more detail below.
You can skip all that and just go straight to the the Net::LDAP::Entry manpage object through the "ldap_entry" method:
my $entry = $c->user->ldap_entry;
It also has support for Roles.
Takes a the Catalyst::Plugin::Authentication::Store::LDAP::Backend manpage object as $store, and the data structure returned by that class's "get_user" method as $user.
Returns a the Catalyst::Plugin::Authentication::Store::LDAP::User manpage object.
Returns the results of the "stringify" method.
Uses the "user_field" configuration option to determine what the "username" of this object is, and returns it.
If you use the special value "dn" for user_field, it will return the DN of the the Net::LDAP::Entry manpage object.
Returns hashref of features that this Authentication::User subclass supports.
check_password($password)Bind's to the directory as the DN of the internal the Net::LDAP::Entry manpage object, using the bind password supplied in $password. Returns 1 on a successful bind, 0 on failure.
Returns the results of the Catalyst::Plugin::Authentication::Store::LDAP::Backend manpage's "lookup_roles" method, an array of roles that are valid for this user.
Returns the User object, stringified.
Returns the raw ldap_entry.
attributes($type)Returns an array of attributes present for this user. If $type is "ashash", it will return a hash with the attribute names as keys. (And the values of those attributes as, well, the values of the hash)
Returns the values for an attribute, or undef if that attribute is not present. The safest way to get at an attribute.
We automatically map the attributes of the underlying the Net::LDAP::Entry manpage object to read-only accessor methods. So, if you have an entry that looks like this one:
dn: cn=adam,ou=users,dc=yourcompany,dc=com
cn: adam
loginShell: /bin/zsh
homeDirectory: /home/adam
gecos: Adam Jacob
gidNumber: 100
uidNumber: 1053
mail: adam@yourcompany.com
uid: adam
givenName: Adam
sn: Jacob
objectClass: inetOrgPerson
objectClass: organizationalPerson
objectClass: Person
objectClass: Top
objectClass: posixAccount
You can call:
$c->user->homedirectory
And you'll get the value of the "homeDirectory" attribute. Note that all the AUTOLOADed methods are automatically lower-cased.
The highly useful and common method "username" will map to the configured value of user_field (uid by default.)
$c->user->username == $c->user->uid
Adam Jacob <holoway@cpan.org>
Some parts stolen shamelessly and entirely from the Catalyst::Plugin::Authentication::Store::Htpasswd manpage.
Realms API patches from Peter Karman <karman@cpan.org>.
To nothingmuch, ghenry, castaway and the rest of #catalyst for the help. :)
the Catalyst::Plugin::Authentication::Store::LDAP manpage, the Catalyst::Plugin::Authentication::Store::LDAP::Backend manpage, the Catalyst::Plugin::Authentication manpage, the Net::LDAP manpage
Copyright (c) 2005 the aforementioned authors. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst::Plugin::Authentication::Store::LDAP::User |