| 1 | package OpusVL::AppKit::RolesFor::Model::LDAPAuth; | ||
| 2 | |||
| 3 | use namespace::autoclean; | ||
| 4 | use Moose::Role; | ||
| 5 | use OpusVL::AppKit::LDAPAuth; | ||
| 6 | |||
| 7 | 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 | has user_base_dn => (is => 'ro', isa => 'Str', default => 'ou=People,dc=opusvl'); | ||
| 12 | has user_field => (is => 'ro', isa => 'Str', default => 'uid'); | ||
| 13 | |||
| 14 | after 'BUILD' => sub | ||
| 15 | { | ||
| 16 | my $self = shift; | ||
| 17 | # copy the config over, | ||
| 18 | # this seems icky. | ||
| 19 | die 'You must apply the OpusVL::AppKit::RolesFor::Schema::LDAPAuth role to the Schema' | ||
| 20 | unless $self->schema->can('password_check'); | ||
| 21 | $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 | }; | ||
| 27 | |||
| 28 | 1; | ||
| 29 | |||
| 30 | __END__ |