NAME
Parse::WWWAuthenticate - Parse the WWW-Authenticate HTTP header
VERSION
version 0.04
SYNOPSIS
my
$header
=
'Basic realm="test"'
;
my
@challenges
= parse_wwwa(
$header
);
for
my
$challenge
(
@challenges
) {
"Server accepts: "
.
$challenge
->{name};
}
kinda more real life:
use
LWP::UserAgent;
my
$ua
= LWP::UserAgent->new;
my
$header
=
$response
->header(
'WWW-Authenticate'
);
my
@challenges
= parse_wwwa(
$header
);
for
my
$challenge
(
@challenges
) {
"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
) {
"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)