~ubuntu-branches/ubuntu/saucy/libnet-ldap-perl/saucy

« back to all changes in this revision

Viewing changes to lib/Net/LDAP/Control/ProxyAuth.pm

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2012-02-08 00:28:33 UTC
  • mfrom: (4.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20120208002833-a15q5uh1pp1e4wgu
Tags: 1:0.4400-1
* New upstream release.
* Remove patch 0001-un-break-certificate-verification.patch.
* Update spelling patch.
* Update upstream and packaging copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
use Net::LDAP::Control;
9
9
 
10
10
@ISA = qw(Net::LDAP::Control);
11
 
$VERSION = "1.05";
 
11
$VERSION = "1.06";
12
12
 
13
 
use Net::LDAP::Constant qw(LDAP_CONTROL_PROXYAUTHENTICATION);
 
13
use Net::LDAP::Constant qw(LDAP_CONTROL_PROXYAUTHORIZATION);
14
14
use Net::LDAP::ASN qw(proxyAuthValue);
15
15
use strict;
16
16
 
17
 
sub LDAP_CONTROL_PROXYAUTHENTICATION_OLD { "2.16.840.1.113730.3.4.12"; }
 
17
sub LDAP_CONTROL_PROXYAUTHORIZATION_OLD { "2.16.840.1.113730.3.4.12"; }
18
18
 
19
19
sub init {
20
20
  my($self) = @_;
22
22
  delete $self->{asn};
23
23
 
24
24
  if (defined($self->{proxyDN})) {
25
 
    $self->{type} = LDAP_CONTROL_PROXYAUTHENTICATION_OLD;
 
25
    $self->{type} = LDAP_CONTROL_PROXYAUTHORIZATION_OLD;
26
26
  
27
27
    unless (exists $self->{value}) {
28
28
      $self->{asn} = { proxyDN => $self->{proxyDN} || '' };
45
45
  if (@_) {
46
46
    delete $self->{value};
47
47
    
48
 
    $self->{type} = LDAP_CONTROL_PROXYAUTHENTICATION_OLD;
 
48
    $self->{type} = LDAP_CONTROL_PROXYAUTHORIZATION_OLD;
49
49
    return $self->{asn}{proxyDN} = shift || '';
50
50
  }
51
 
  elsif ($self->{type} eq LDAP_CONTROL_PROXYAUTHENTICATION) {
 
51
  elsif ($self->{type} eq LDAP_CONTROL_PROXYAUTHORIZATION) {
52
52
    $self->{error} = 'Illegal query method: use authzID()';
53
53
    return undef;
54
54
  }
66
66
  if (@_) {
67
67
    delete $self->{value};
68
68
    
69
 
    $self->{type} = LDAP_CONTROL_PROXYAUTHENTICATION;
 
69
    $self->{type} = LDAP_CONTROL_PROXYAUTHORIZATION;
70
70
    return $self->{authzID} = shift || '';
71
71
  }
72
 
  elsif ($self->{type} eq LDAP_CONTROL_PROXYAUTHENTICATION_OLD) {
 
72
  elsif ($self->{type} eq LDAP_CONTROL_PROXYAUTHORIZATION_OLD) {
73
73
    $self->{error} = 'Illegal query method: use proxyDN()';
74
74
    return undef;
75
75
  }
85
85
  my $self = shift;
86
86
 
87
87
  unless (exists $self->{value}) {
88
 
    $self->{value} = ($self->{type} eq LDAP_CONTROL_PROXYAUTHENTICATION_OLD)
 
88
    $self->{value} = ($self->{type} eq LDAP_CONTROL_PROXYAUTHORIZATION_OLD)
89
89
                     ? $proxyAuthValue->encode($self->{asn})
90
90
                     : $self->{authzID} || '';
91
91
  }
99
99
 
100
100
=head1 NAME
101
101
 
102
 
Net::LDAP::Control::ProxyAuth - LDAPv3 Proxy Authentication control object
 
102
Net::LDAP::Control::ProxyAuth - LDAPv3 Proxy Authorization control object
103
103
 
104
104
=head1 SYNOPSIS
105
105
 
130
130
=head1 DESCRIPTION
131
131
 
132
132
C<Net::LDAP::Control::ProxyAuth> provides an interface for the creation and manipulation
133
 
of objects that represent the C<proxyauthorisationControl> as described by draft-weltman-ldapv3-proxy-XX.txt.
 
133
of objects that represent the C<Proxy Authorization Control> as described by RFC 4370.
 
134
 
 
135
It allows a client to be bound to an LDAP server with its own identity, but to perform
 
136
operations on behalf of another user, the C<authzID>.
 
137
 
 
138
With the exception of any extension that causes a change in authentication,
 
139
authorization or data confidentiality, a single C<Proxy Authorization Control>
 
140
may be included in any search, compare, modify, add, delete, or moddn or
 
141
extended operation.
 
142
 
 
143
As cqrequired by the RFC, the criticality of this control is automatically set to
 
144
TRUE in order to protect clients from submitting requests with other identities
 
145
that they intend to.
 
146
 
134
147
 
135
148
=head1 CONSTRUCTOR ARGUMENTS
136
149
 
141
154
 
142
155
=item authzID
143
156
 
144
 
The authzID that is required. This is the identity we are requesting operations to use
 
157
The authzID that is required. This is the identity we are requesting operations to use.
145
158
 
146
159
=item proxyDN
147
160
 
148
 
In older versions of draft-weltman-ldapv3-proxy-XX.txt the value in the control and thus the
149
 
constructor argument was a DN and was called C<proxyDN>. It served the same purpose as C<authzID>
150
 
in recent versions of C<proxyauthorisationControl>.
 
161
In early versions of the drafts to RFC 4370, draft-weltman-ldapv3-proxy-XX.txt,
 
162
the value in the control and thus the constructor argument was a DN and was called C<proxyDN>.
 
163
It served the same purpose as C<authzID> in recent versions of C<proxyAuthorization> control.
151
164
 
152
165
=back
153
166
 
154
167
B<Please note:>
155
 
Unfortunately the OID and the encoding or the C<proxyauthorisationControl>
156
 
changed significantly in recent versions of draft-weltman-ldapv3-proxy-XX.txt.
 
168
Unfortunately the OID and the encoding or the C<Proxy Authorization Control>
 
169
changed significantly between early versions of draft-weltman-ldapv3-proxy-XX.txt
 
170
and the final RFC.
157
171
Net::LDAP::Control::ProxyAuth tries to cope with that situation and changes
158
172
the OID and encoding used depending on the constructor argument.
159
173
 
173
187
L<Net::LDAP>,
174
188
L<Net::LDAP::Control>,
175
189
 
176
 
=head1 AUTHOR
 
190
=head1 AUTHORS
177
191
 
178
192
Olivier Dubois, Swift sa/nv based on Net::LDAP::Control::Page from
179
193
Graham Barr E<lt>gbarr@pobox.comE<gt>.