Codebase list libapache-session-ldap-perl / 430488b
Merge tag 'upstream/0.4' Upstream version 0.4 gregor herrmann 8 years ago
6 changed file(s) with 118 addition(s) and 48 deletion(s). Raw diff Collapse all Expand all
55 lib/Apache/Session/LDAP.pm
66 lib/Apache/Session/Store/LDAP.pm
77 META.yml Module meta-data (added by MakeMaker)
8 META.json Module JSON meta-data (added by MakeMaker)
0 {
1 "abstract" : "An implementation of Apache::Session",
2 "author" : [
3 "Xavier Guimard <guimard@>"
4 ],
5 "dynamic_config" : 1,
6 "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060",
7 "license" : [
8 "unknown"
9 ],
10 "meta-spec" : {
11 "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
12 "version" : "2"
13 },
14 "name" : "Apache-Session-LDAP",
15 "no_index" : {
16 "directory" : [
17 "t",
18 "inc"
19 ]
20 },
21 "prereqs" : {
22 "build" : {
23 "requires" : {
24 "ExtUtils::MakeMaker" : "0"
25 }
26 },
27 "configure" : {
28 "requires" : {
29 "ExtUtils::MakeMaker" : "0"
30 }
31 },
32 "runtime" : {
33 "requires" : {
34 "Apache::Session" : "0",
35 "Net::LDAP" : "0"
36 }
37 }
38 },
39 "release_status" : "stable",
40 "version" : "0.4"
41 }
0 --- #YAML:1.0
1 name: Apache-Session-LDAP
2 version: 0.2
3 abstract: An implementation of Apache::Session
0 ---
1 abstract: 'An implementation of Apache::Session'
42 author:
5 - Xavier Guimard <x.guimard@free.fr>
6 license: perl
7 distribution_type: module
3 - 'Xavier Guimard <guimard@>'
4 build_requires:
5 ExtUtils::MakeMaker: '0'
86 configure_requires:
9 ExtUtils::MakeMaker: 0
10 build_requires:
11 ExtUtils::MakeMaker: 0
7 ExtUtils::MakeMaker: '0'
8 dynamic_config: 1
9 generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142060'
10 license: unknown
11 meta-spec:
12 url: http://module-build.sourceforge.net/META-spec-v1.4.html
13 version: '1.4'
14 name: Apache-Session-LDAP
15 no_index:
16 directory:
17 - t
18 - inc
1219 requires:
13 Apache::Session: 0
14 Net::LDAP: 0
15 no_index:
16 directory:
17 - t
18 - inc
19 generated_by: ExtUtils::MakeMaker version 6.57_05
20 meta-spec:
21 url: http://module-build.sourceforge.net/META-spec-v1.4.html
22 version: 1.4
20 Apache::Session: '0'
21 Net::LDAP: '0'
22 version: '0.4'
0 Apache-Session-LDAP version 0.3
0 Apache-Session-LDAP version 0.4
11 ================================
22
33 INSTALLATION
22 use strict;
33 use vars qw(@ISA $VERSION);
44
5 $VERSION = '0.3';
5 $VERSION = '0.4';
66 @ISA = qw(Apache::Session);
77
88 use Apache::Session;
3636
3737 use Apache::Session::LDAP;
3838 tie %hash, 'Apache::Session::LDAP', $id, {
39 ldapServer => 'ldap://localhost:389',
40 ldapConfBase => 'dmdName=applications,dc=example,dc=com',
41 ldapBindDN => 'cn=admin,dc=example,dc=com',
42 ldapBindPassword => 'pass',
39 ldapServer => 'ldap://localhost:389',
40 ldapConfBase => 'dmdName=applications,dc=example,dc=com',
41 ldapBindDN => 'cn=admin,dc=example,dc=com',
42 ldapBindPassword => 'pass',
43 ldapObjectClass => 'applicationProcess',
44 ldapAttributeId => 'cn',
45 ldapAttributeContent => 'description',
4346 };
4447
4548 =head1 DESCRIPTION
5457 =head1 COPYRIGHT AND LICENSE
5558
5659 Copyright (C) 2009, 2012 by Xavier Guimard
57 Copyright (C) 2014 by Clement Oudot
60 Copyright (C) 2014, 2015 by Clement Oudot
5861
5962 This library is free software; you can redistribute it and/or modify
6063 it under the same terms as Perl itself, either Perl version 5.10.0 or,
33 use vars qw($VERSION);
44 use Net::LDAP;
55
6 $VERSION = '0.3';
6 $VERSION = '0.4';
77
88 sub new {
99 my $class = shift;
1414 my $self = shift;
1515 my $session = shift;
1616 $self->{args} = $session->{args};
17 $self->{args}->{ldapObjectClass} ||= 'applicationProcess';
18 $self->{args}->{ldapAttributeId} ||= 'cn';
19 $self->{args}->{ldapAttributeContent} ||= 'description';
1720
1821 my $msg = $self->ldap->add(
19 "cn=$session->{data}->{_session_id}," . $self->{args}->{ldapConfBase},
22 $self->{args}->{ldapAttributeId} . "="
23 . $session->{data}->{_session_id} . ","
24 . $self->{args}->{ldapConfBase},
2025 attrs => [
21 objectClass => [ 'top', 'applicationProcess' ],
22 cn => $session->{data}->{_session_id},
23 description => $session->{serialized},
26 objectClass => $self->{args}->{ldapObjectClass},
27 $self->{args}->{ldapAttributeId} => $session->{data}->{_session_id},
28 $self->{args}->{ldapAttributeContent} => $session->{serialized},
2429 ],
2530 );
2631
3237 my $self = shift;
3338 my $session = shift;
3439 $self->{args} = $session->{args};
40 $self->{args}->{ldapObjectClass} ||= 'applicationProcess';
41 $self->{args}->{ldapAttributeId} ||= 'cn';
42 $self->{args}->{ldapAttributeContent} ||= 'description';
3543
3644 my $msg = $self->ldap->modify(
37 "cn=$session->{data}->{_session_id}," . $self->{args}->{ldapConfBase},
38 replace => { description => $session->{serialized}, },
45 $self->{args}->{ldapAttributeId} . "="
46 . $session->{data}->{_session_id} . ","
47 . $self->{args}->{ldapConfBase},
48 replace =>
49 { $self->{args}->{ldapAttributeContent} => $session->{serialized}, },
3950 );
4051
4152 $self->ldap->unbind() && delete $self->{ldap};
4657 my $self = shift;
4758 my $session = shift;
4859 $self->{args} = $session->{args};
60 $self->{args}->{ldapObjectClass} ||= 'applicationProcess';
61 $self->{args}->{ldapAttributeId} ||= 'cn';
62 $self->{args}->{ldapAttributeContent} ||= 'description';
4963
5064 my $msg = $self->ldap->search(
51 base => "cn=$session->{data}->{_session_id},"
65 base => $self->{args}->{ldapAttributeId} . "="
66 . $session->{data}->{_session_id} . ","
5267 . $self->{args}->{ldapConfBase},
53 filter => '(objectClass=applicationProcess)',
68 filter => '(objectClass=' . $self->{args}->{ldapObjectClass} . ')',
5469 scope => 'base',
55 attrs => ['description'],
70 attrs => [ $self->{args}->{ldapAttributeContent} ],
5671 );
5772
5873 $self->ldap->unbind() && delete $self->{ldap};
5974 $self->logError($msg) if ( $msg->code );
6075
6176 eval {
62 $session->{serialized} = $msg->shift_entry()->get_value('description');
77 $session->{serialized} = $msg->shift_entry()
78 ->get_value( $self->{args}->{ldapAttributeContent} );
6379 };
6480
6581 if ( !defined $session->{serialized} ) {
7187 my $self = shift;
7288 my $session = shift;
7389 $self->{args} = $session->{args};
74
75 $self->ldap->delete(
76 "cn=$session->{data}->{_session_id}," . $self->{args}->{ldapConfBase} );
90 $self->{args}->{ldapObjectClass} ||= 'applicationProcess';
91 $self->{args}->{ldapAttributeId} ||= 'cn';
92 $self->{args}->{ldapAttributeContent} ||= 'description';
93
94 $self->ldap->delete( $self->{args}->{ldapAttributeId} . "="
95 . $session->{data}->{_session_id} . ","
96 . $self->{args}->{ldapConfBase} );
7797
7898 $self->ldap->unbind() && delete $self->{ldap};
7999 }
166186 =head1 OPTIONS
167187
168188 This module requires one argument in the usual Apache::Session style. The
169 keys ldapServer, ldapBase, ldapBindDN, ldapBindPassword are required. The key
170 ldapPort is optional. Example:
189 keys ldapServer, ldapBase, ldapBindDN, ldapBindPassword are required. The keys
190 ldapPort, ldapObjectClass, ldapAttributeId, ldapAttributeContent are optional.
191 Example:
171192
172193 tie %s, 'Apache::Session::LDAP', undef,
173194 {
174 ldapServer => 'localhost',
175 ldapBase => 'dc=example,dc=com',
176 ldapBindDN => 'cn=admin,dc=example,dc=com',
177 ldapBindPassword => 'pass',
195 ldapServer => 'localhost',
196 ldapBase => 'dc=example,dc=com',
197 ldapBindDN => 'cn=admin,dc=example,dc=com',
198 ldapBindPassword => 'pass',
199 ldapObjectClass => 'applicationProcess',
200 ldapAttributeId => 'cn',
201 ldapAttributeContent => 'description',
178202 };
179203
180204 =head1 AUTHOR
184208 =head1 COPYRIGHT AND LICENSE
185209
186210 Copyright (C) 2009, 2012 by Xavier Guimard
187 Copyright (C) 2014 by Clement Oudot
211 Copyright (C) 2014, 2015 by Clement Oudot
188212
189213 This library is free software; you can redistribute it and/or modify
190214 it under the same terms as Perl itself, either Perl version 5.10.0 or,