IDS-HTTP

 view release on metacpan or  search on metacpan

lib/IDS/DataSource/HTTP/Authorization.pm  view on Meta::CPAN


$IDS::DataSource::HTTP::Authorization::VERSION     = "1.0";

sub empty {
    my $self  = shift;
    undef $self->{"data"}, $self->{"tokens"};
}

sub parse {
    my $self  = shift;
    my $credentials = $self->{"data"}; # convenience
    my @tokens = ();

    $self->mesg(1, *parse{PACKAGE} .  "::parse: data '$credentials'");
    my $base64pat = qr![0-9A-Za-z+/=]+!;
    
    ### Need to fill this out with more auth styles
    if ($credentials =~ /^Basic\s+($base64pat+)$/) {
        push @tokens, "Basic auth credentials"; 
	### should have a param to indicate whether or not to include
	### the hash
    } else {
	my $pmsg = *parse{PACKAGE} .  "::parse: In " .
                 ${$self->{"params"}}{"source"} .
                 " unknown auth credentials '$credentials'\n";
        $self->warn($pmsg, \@tokens, "!unknown auth credentials");
    }

    $self->mesg(2, *parse{PACKAGE} .  "::parse: tokens\n    ",
                "\n    ", \@tokens);
    $self->{"tokens"} = \@tokens;
}

# accessor functions not provided by the superclass

=head1 AUTHOR INFORMATION



( run in 0.236 second using v1.01-cache-2.11-cpan-4d50c553e7e )