NAME

Mojo::UserAgent::DigestAuth - Allow Mojo::UserAgent to execute digest auth requests

VERSION

0.03

DESCRIPTION

Mojo::UserAgent::DigestAuth is a Mojo::UserAgent "plugin" which can handle 401 digest auth responses from the server.

See http://en.wikipedia.org/wiki/Digest_access_authentication.

SYNOPSIS

use Mojo::UserAgent::DigestAuth;
my $ua = Mojo::UserAgent->new;

# blocking
$tx = $ua->$_request_with_digest_auth($method, $url, $headers);

# non-blocking
$ua = $ua->$_request_with_digest_auth($method, $url, $headers, $cb);
$ua = $ua->$_request_with_digest_auth($method, $url, $cb);

$ua = $ua->$_request_with_digest_auth(
  get => "http://example.com", sub {
    my ($ua, $tx) = @_;
  }
);

A custom client nonce can be specified by using a special "D-Client-Nonce" header. This is a hack to work around servers which does not understand the nonce generated by this module.

Note that this feature is EXPERIMENTAL and might be removed once I figure out why the random nonce does not work for all servers.

$ua = $ua->$_request_with_digest_auth(
  get => { "D-Client-Nonce" => "0e163838ccd62299" },
  "http://example.com", sub {
    my ($ua, $tx) = @_;
  }
);

COPYRIGHT AND LICENSE

Copyright (C) 2014, Jan Henning Thorsen

This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org