HTTP/Authorization.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 40 CC 2 SCAR 11.5
CC
2
Cov
0%
parse
6.0
empty
2.0
BEGIN
2.0
CRAP 3.1
1 # HTTP Authorization from RFC 2616 section 14.8, RFC 2617 (primary)
2 # Base 64 is from RFC 3548 (and earlier RFCs as well)
3 #
4 # subclass of HTTP; see that for interface requirements
5 #
6  
7 package IDS::DataSource::HTTP::Authorization;
8  
9 use strict;
10 use warnings;
11 use Carp qw(carp confess);
12 use base qw(IDS::DataSource::HTTP::Part);
13  
14 $IDS::DataSource::HTTP::Authorization::VERSION = "1.0";
15  
16 sub empty {
17 my $self = shift;
18 undef $self->{"data"}, $self->{"tokens"};
19 }
20  
21 sub parse {
22 my $self = shift;
23 my $credentials = $self->{"data"}; # convenience
24 my @tokens = ();
25  
26 $self->mesg(1, *parse{PACKAGE} . "::parse: data '$credentials'");
27 my $base64pat = qr![0-9A-Za-z+/=]+!;
28
29 ### Need to fill this out with more auth styles
30 if ($credentials =~ /^Basic\s+($base64pat+)$/) {
31 push @tokens, "Basic auth credentials";
32 ### should have a param to indicate whether or not to include
33 ### the hash
34 } else {
35 my $pmsg = *parse{PACKAGE} . "::parse: In " .
36 ${$self->{"params"}}{"source"} .
37 " unknown auth credentials '$credentials'\n";
38 $self->warn($pmsg, \@tokens, "!unknown auth credentials");
39 }
40  
41 $self->mesg(2, *parse{PACKAGE} . "::parse: tokens\n ",
42 "\n ", \@tokens);
43 $self->{"tokens"} = \@tokens;
44 }
45  
46 # accessor functions not provided by the superclass
47  
48 =head1 AUTHOR INFORMATION
49  
50 Copyright 2005-2007, Kenneth Ingham. All rights reserved.
51  
52 This library is free software; you can redistribute it and/or modify
53 it under the same terms as Perl itself.
54  
55 Address bug reports and comments to: ids_test at i-pi.com. When sending
56 bug reports, please provide the versions of IDS::Test.pm, IDS::Algorithm.pm,
57 IDS::DataSource.pm, the version of Perl, and the name and version of the
58 operating system you are using. Since Kenneth is a PhD student, the
59 speed of the reponse depends on how the research is proceeding.
60  
61 =head1 BUGS
62  
63 Please report them.
64  
65 =head1 SEE ALSO
66  
67 L<IDS::Algorithm>, L<IDS::DataSource>
68  
69 =cut
70  
71 1;