NAME

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

DESCRIPTION

Mojo::UserAgent::Role::DigestAuth is a Mojo::UserAgent role that can handle 401 digest auth responses from the server.

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

SYNOPSIS

use Mojo::UserAgent;
my $ua = Mojo::UserAgent->with_roles('+DigestAuth')->new;

# blocking
$tx = $ua->get($url);

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

# promise based
$p = $ua->post_p($method, $url)->then(sub { ... });

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.

$tx = $ua->get('http://example.com', { 'D-Client-Nonce' => '0e163838ccd62299' });

COPYRIGHT AND LICENSE

Copyright (C) 2014-2021, 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