NAME

Parse::WWWAuthenticate - Parse the WWW-Authenticate HTTP header

VERSION

version 0.04

SYNOPSIS

use Parse::WWWAuthenticate qw(parse_wwwa);

my $header = 'Basic realm="test"';
my @challenges = parse_wwwa( $header );
for my $challenge ( @challenges ) {
    print "Server accepts: " . $challenge->{name};
}

kinda more real life:

use LWP::UserAgent;
use Parse::WWWAuthenticate qw(parse_wwwa);

my $ua       = LWP::UserAgent->new;
my $response = $ua->get('http://some.domain.example');
my $header   = $response->header('WWW-Authenticate');

my @challenges = parse_wwwa( $header );
for my $challenge ( @challenges ) {
    print "Try to use $challenge->{name}...\n";
}

FUNCTIONS

parse_wwwa

parses the content of the WWW-Authenticate header and returns a hash of all the challenges and their data.

my $header = 'Basic realm="test"';
my @challenges = parse_wwwa( $header );
for my $challenge ( @challenges ) {
    print "Try to use $challenge->{name}...\n";
}

split_header_words

ACKNOWLEDGEMENTS

The testcases were generated with the httpauth.xml file from https://greenbyte.de/tech/tc/httpauth.

AUTHOR

Renee Baecker <reneeb@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016 by Renee Baecker.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)