Net::Duo::Auth::Async

(Representation of an asynchronous Duo authentication)

SYNOPSIS

    use 5.010;

    my $config = get_config();
    my $duo = Net::Duo::Auth->new($config);
    my $async = $duo->auth_async({ username => 'user', factor => 'auto' });
    say scalar($async->status);

REQUIREMENTS

Perl 5.14 or later and the modules HTTP::Request and HTTP::Response (part of HTTP::Message), JSON, LWP (also known as libwww-perl), Perl6::Slurp, Sub::Install, and URI::Escape (part of URI), all of which are available from CPAN.

DESCRIPTION

Net::Duo::Auth::Async represents an open asynchronous authentication attempt with Duo. It's a wrapper around the Duo async transaction ID and the method to check on the status of that transaction. This object can either be created directly from a stored transaction ID or is returned by the auth_async() method of Net::Duo::Auth.

CLASS METHODS

new(DUO, ID)

Create a new Net::Duo::Auth::Async object from a Net::Duo object and a transaction. This should be used to recreate the Net::Duo::Auth::Async object if the transaction ID were handed off to some other process that then asks for status later.

INSTANCE METHODS

id()

Returns the transaction ID represented by this object. This transaction ID can be used later to recreate the object.

status()

Returns the status of the authentication.

In scalar context, returns only the status, which will be one of allow, deny, and waiting. waiting indicates that the authentication is still in progress and has not yet completed.

In list context, returns the same status as the first element and a reference to a hash of additional information as the second element. The hash will have one or more of the following keys:

status

String detailing the progress or outcome of the authentication attempt. See the Duo Auth API documentation for a complete list of possible values.

status_msg

A string describing the result of the authentication attempt. If the authentication attempt was denied, it may identify a reason. This string is intended for display to the user.

trusted_device_token

If the trusted devices option is enabled for this account, returns a token for a trusted device that can later be passed to the Duo preauth endpoint.

AUTHOR

Russ Allbery <rra@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2014 The Board of Trustees of the Leland Stanford Junior University

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

SEE ALSO

Duo Auth API

This module is part of the Net::Duo distribution. The current version of Net::Duo is available from CPAN, or directly from its web site at <http://www.eyrie.org/~eagle/software/net-duo/>.

Last modified and spun 2015-08-16