File Coverage

blib/lib/Authen/SASL/Perl/PLAIN.pm
Criterion Covered Total %
statement 15 16 93.8
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 22 26 84.6


line stmt bran cond sub pod time code
1             # Copyright (c) 2002 Graham Barr <gbarr@pobox.com>. All rights reserved.
2             # This program is free software; you can redistribute it and/or
3             # modify it under the same terms as Perl itself.
4              
5             package Authen::SASL::Perl::PLAIN;
6              
7 3     3   41 use strict;
  3         28  
  3         48  
8 3     3   47 use vars qw($VERSION @ISA);
  3         109  
  3         57  
9              
10             $VERSION = "1.04";
11             @ISA = qw(Authen::SASL::Perl);
12              
13             my %secflags = (
14             noanonymous => 1,
15             );
16              
17 55     55   541 sub _order { 1 }
18             sub _secflags {
19 16     16   137   shift;
20 16         357   grep { $secflags{$_} } @_;
  0         0  
21             }
22              
23 4     4 0 59 sub mechanism { 'PLAIN' }
24              
25             sub client_start {
26 2     2 0 18   my $self = shift;
27              
28 6         76   my @parts = map {
29 2         20     my $v = $self->_call($_);
30 6 50       71     defined($v) ? $v : ''
31               } qw(authname user pass);
32              
33 2         36   join("\0", @parts);
34             }
35              
36             1;
37              
38             __END__
39            
40             =head1 NAME
41            
42             Authen::SASL::Perl::PLAIN - Plain Login Authentication class
43            
44             =head1 SYNOPSIS
45            
46             use Authen::SASL qw(Perl);
47            
48             $sasl = Authen::SASL->new(
49             mechanism => 'PLAIN',
50             callback => {
51             user => $user,
52             pass => $pass
53             },
54             );
55            
56             =head1 DESCRIPTION
57            
58             This method implements the client part of the PLAIN SASL algorithm,
59             as described in RFC 2595 resp. IETF Draft draft-ietf-sasl-plain-04.txt
60             from February 2004.
61            
62             =head2 CALLBACK
63            
64             The callbacks used are:
65            
66             =over 4
67            
68             =item authname
69            
70             The authorization id to use after successful authentication
71            
72             =item user
73            
74             The username to be used for authentication
75            
76             =item pass
77            
78             The user's password to be used for authentication
79            
80             =back
81            
82             =head1 SEE ALSO
83            
84             L<Authen::SASL>,
85             L<Authen::SASL::Perl>
86            
87             =head1 AUTHORS
88            
89             Software written by Graham Barr <gbarr@pobox.com>,
90             documentation written by Peter Marschall <peter@adpm.de>.
91            
92             Please report any bugs, or post any suggestions, to the perl-ldap mailing list
93             <perl-ldap@perl.org>
94            
95             =head1 COPYRIGHT
96            
97             Copyright (c) 2002-2004 Graham Barr.
98             All rights reserved. This program is free software; you can redistribute
99             it and/or modify it under the same terms as Perl itself.
100            
101             Documentation Copyright (c) 2004 Peter Marschall.
102             All rights reserved. This documentation is distributed,
103             and may be redistributed, under the same terms as Perl itself.
104            
105             =cut
106