« blib/lib/OpusVL/AppKit/Controller/AppKit/User.pm
↑ Summary
blib/lib/OpusVL/AppKit/Plugin/AppKit/FeatureList.pm »
| 1 | package OpusVL::AppKit::RolesFor::Model::LDAPAuth; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use OpusVL::AppKit::LDAPAuth; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | has ldap_server => (is => 'rw', isa => 'Str', default => 'wrong'); | |||||||||
| 8 | |||||||||||
| 9 | # NOTE: we assume that the dn parts we're given are already correctly escaped if | ||||||||||
| 10 | # necessary. | ||||||||||
| 11 | 1 | has user_base_dn => (is => 'ro', isa => 'Str', default => 'ou=People,dc=opusvl'); | |||||||||
| 12 | 1 | has user_field => (is => 'ro', isa => 'Str', default => 'uid'); | |||||||||
| 13 | |||||||||||
| 14 | after 'BUILD' => sub | ||||||||||
| 15 | { | ||||||||||
| 16 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 17 | # copy the config over, | ||||||||||
| 18 | # this seems icky. | ||||||||||
| 19 | 0 | ▶ | die 'You must apply the OpusVL::AppKit::RolesFor::Schema::LDAPAuth role to the Schema' | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | unless $self->schema->can('password_check'); | ||||||||||
| 21 | 0 | $self->schema->password_check(OpusVL::AppKit::LDAPAuth->new({ | |||||||||
| 22 | ldap_server => $self->ldap_server, | ||||||||||
| 23 | user_base_dn => $self->user_base_dn, | ||||||||||
| 24 | user_field => $self->user_field, | ||||||||||
| 25 | })); | ||||||||||
| 26 | 1 | }; | |||||||||
| 27 | |||||||||||
| 28 | 1 | 1; | |||||||||
| 29 | |||||||||||
| 30 | __END__ | ||||||||||
| 31 | |||||||||||
| 32 | =pod | ||||||||||
| 33 | |||||||||||
| 34 | =encoding UTF-8 | ||||||||||
| 35 | |||||||||||
| 36 | =head1 NAME | ||||||||||
| 37 | |||||||||||
| 38 | OpusVL::AppKit::RolesFor::Model::LDAPAuth | ||||||||||
| 39 | |||||||||||
| 40 | =head1 VERSION | ||||||||||
| 41 | |||||||||||
| 42 | version 2.24 | ||||||||||
| 43 | |||||||||||
| 44 | =head1 SYNOPSIS | ||||||||||
| 45 | |||||||||||
| 46 | # in your model | ||||||||||
| 47 | __PACKAGE__->config( | ||||||||||
| 48 | schema_class => 'Aquarius::OpenERP::Schema', | ||||||||||
| 49 | traits => ['+OpusVL::AppKit::RolesFor::Model::LDAPAuth'], | ||||||||||
| 50 | ); | ||||||||||
| 51 | |||||||||||
| 52 | # or in your catalyst.conf, | ||||||||||
| 53 | |||||||||||
| 54 | traits +OpusVL::AppKit::RolesFor::Model::LDAPAuth | ||||||||||
| 55 | ldap_server ldap | ||||||||||
| 56 | user_base_dn ou=People,dc=opusvl | ||||||||||
| 57 | user_field uid | ||||||||||
| 58 | |||||||||||
| 59 | # when authenticating a user we will identify the user by | ||||||||||
| 60 | # $user_field=$username,$user_base_dn | ||||||||||
| 61 | |||||||||||
| 62 | =head1 DESCRIPTION | ||||||||||
| 63 | |||||||||||
| 64 | This trait extends your DBIC Model to setup the OpusVL::AppKit::LDAPAuth module. | ||||||||||
| 65 | |||||||||||
| 66 | =head1 NAME | ||||||||||
| 67 | |||||||||||
| 68 | OpusVL::AppKit::RolesFor::Model::LDAPAuth | ||||||||||
| 69 | |||||||||||
| 70 | =head1 ATTRIBUTES | ||||||||||
| 71 | |||||||||||
| 72 | =head2 ldap_server | ||||||||||
| 73 | |||||||||||
| 74 | The LDAP server address. i.e. ldap.opusvl.com | ||||||||||
| 75 | |||||||||||
| 76 | =head2 user_base_dn | ||||||||||
| 77 | |||||||||||
| 78 | The dn for locating a user, excluding the actual username bit. | ||||||||||
| 79 | |||||||||||
| 80 | For example, if uid=colin,ou=People,dc=opusvl identifies the user colin then the | ||||||||||
| 81 | user_base_dn should be "ou=People,dc=opusvl". | ||||||||||
| 82 | |||||||||||
| 83 | =head2 user_field | ||||||||||
| 84 | |||||||||||
| 85 | This is the field used to identify the username in LDAP. Assuming you have the dn | ||||||||||
| 86 | used in the previous example this should be uid. | ||||||||||
| 87 | |||||||||||
| 88 | =head1 SEE ALSO | ||||||||||
| 89 | |||||||||||
| 90 | To complete the integration with Catalyst you need to add the trait | ||||||||||
| 91 | L<OpusVL::AppKit::RolesFor::Schema::LDAPAuth> to your schema class too. | ||||||||||
| 92 | |||||||||||
| 93 | L<OpusVL::AppKit::LDAPAuth> is the class used to do the actual authentication. | ||||||||||
| 94 | |||||||||||
| 95 | =head1 AUTHOR | ||||||||||
| 96 | |||||||||||
| 97 | OpusVL - www.opusvl.com | ||||||||||
| 98 | |||||||||||
| 99 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 100 | |||||||||||
| 101 | This software is copyright (c) 2010 by OpusVL - www.opusvl.com. | ||||||||||
| 102 | |||||||||||
| 103 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 104 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 105 | |||||||||||
| 106 | =cut | ||||||||||