.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Net::Duo::Auth 3pm" .TH Net::Duo::Auth 3pm "2015-08-16" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Net::Duo::Auth \- Perl interface for the Duo Auth API .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& my $duo = Net::Duo::Auth\->new({ key_file => \*(Aq/path/to/keys.json\*(Aq }); \& my $timestamp = $duo\->check; .Ve .SH "REQUIREMENTS" .IX Header "REQUIREMENTS" Perl 5.14 or later and the modules HTTP::Request and HTTP::Response (part of HTTP::Message), \s-1JSON, LWP \s0(also known as libwww-perl), Perl6::Slurp, Sub::Install, and URI::Escape (part of \s-1URI\s0), all of which are available from \s-1CPAN.\s0 .SH "DESCRIPTION" .IX Header "DESCRIPTION" Net::Duo::Auth is an implementation of the Duo Auth \s-1REST API\s0 for Perl. Method calls correspond to endpoints in the \s-1REST API. \s0 Its goal is to provide a native, natural interface for all Duo operations in the \s-1API\s0 from inside Perl, while abstracting away as many details of the \s-1API\s0 as can be reasonably handled automatically. .PP Currently, only a tiny number of available methods are implemented. .PP For calls that return complex data structures, the return from the call will generally be an object in the Net::Duo::Auth namespace. These objects all have methods matching the name of the field in the Duo \s-1API\s0 documentation that returns that field value. Where it makes sense, there will also be a method with the same name but with \f(CW\*(C`set_\*(C'\fR prepended that changes that value. No changes are made to the Duo record itself until the \fIcommit()\fR method is called on the object, which will make the underlying Duo \s-1API\s0 call to update the data. .PP On failure, all methods throw a Net::Duo::Exception object. This can be interpolated into a string for a simple error message, or inspected with method calls for more details. This is also true of all methods in all objects in the Net::Duo namespace. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .IP "new(\s-1ARGS\s0)" 4 .IX Item "new(ARGS)" Create a new Net::Duo::Auth object, which is used for all subsequent calls. This constructor is inherited from Net::Duo. See Net::Duo for documentation of the possible arguments. .SH "INSTANCE METHODS" .IX Header "INSTANCE METHODS" .IP "auth(\s-1ARGS\s0)" 4 .IX Item "auth(ARGS)" Perform a Duo synchronous authentication. .Sp The user will be authenticated given the factor and additional information provided in \s-1ARGS. \s0 The call will not return until the user has authenticated or the call has failed for some reason. To do long-polling instead, see \fIauth_async()\fR. .Sp \&\s-1ARGS\s0 should be a reference to a hash. The following keys may always be present: .RS 4 .IP "user_id" 4 .IX Item "user_id" The Duo \s-1ID\s0 of the user to authenticate. Either this or \f(CW\*(C`username\*(C'\fR, but only one or the other, must be specified. .IP "username" 4 .IX Item "username" The username of the user to authenticate. Either this or \f(CW\*(C`username\*(C'\fR, but only one or the other, must be specified. .IP "factor" 4 .IX Item "factor" The authentication factor to use, chosen from \f(CW\*(C`push\*(C'\fR, \f(CW\*(C`passcode\*(C'\fR, or \&\f(CW\*(C`phone\*(C'\fR, or \f(CW\*(C`auto\*(C'\fR to use whichever of \f(CW\*(C`push\*(C'\fR or \f(CW\*(C`phone\*(C'\fR appears best for this user's devices according to Duo. Required. .IP "ipaddr" 4 .IX Item "ipaddr" The \s-1IP\s0 address of the user, used for logging and to support sending an \&\f(CW\*(C`allow\*(C'\fR response without further verification if the user is coming from a trusted network as configured in the integration. .RE .RS 4 .Sp Additional keys may be present depending on \f(CW\*(C`factor\*(C'\fR. For a \f(CW\*(C`factor\*(C'\fR value of \f(CW\*(C`push\*(C'\fR: .IP "device" 4 .IX Item "device" The \s-1ID\s0 of the device to which to send the push notification, or \f(CW\*(C`auto\*(C'\fR to send to the first push-capable device. Optional, defaulting to \f(CW\*(C`auto\*(C'\fR. .IP "type" 4 .IX Item "type" This string is displayed in the Duo Mobile app before the word \f(CW\*(C`request\*(C'\fR. The default is \f(CW\*(C`Login\*(C'\fR, so the phrase \f(CW\*(C`Login request\*(C'\fR appears in the push notification text and on the request details screen. You may want to specify \f(CW\*(C`Transaction\*(C'\fR, \f(CW\*(C`Transfer\*(C'\fR, etc. Optional. .IP "display_username" 4 .IX Item "display_username" String to display in Duo Mobile in place of the user's Duo username. Optional. .IP "pushinfo" 4 .IX Item "pushinfo" A reference to a list of additional key/value pairs to display to the user as part of the authentication request. For example: .Sp .Vb 1 \& { pushinfo => [from => \*(Aqlogin portal\*(Aq, domain => \*(Aqexample.com\*(Aq] } .Ve .Sp This is a list rather than a hash so that it preserves the order of arguments, but there should always be an even number of members in the list. .RE .RS 4 .Sp For a \f(CW\*(C`factor\*(C'\fR value of \f(CW\*(C`passcode\*(C'\fR: .IP "passcode" 4 .IX Item "passcode" The passcode to validate. Required. .RE .RS 4 .Sp For a \f(CW\*(C`factor\*(C'\fR value of \f(CW\*(C`phone\*(C'\fR: .IP "phone" 4 .IX Item "phone" The \s-1ID\s0 of the device to call, or \f(CW\*(C`auto\*(C'\fR to call the first available device. Optional and defaults to \f(CW\*(C`auto\*(C'\fR. .RE .RS 4 .Sp In a scalar context, this method returns true if the user was successfully authenticated and false if authentication failed for any reason. In a list context, the same status argument is returned as the first member of the list, and the second member of the list will be a reference to a hash of additional data. Possible keys are: .IP "status" 4 .IX Item "status" String detailing the progress or outcome of the authentication attempt. .IP "status_msg" 4 .IX Item "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. .IP "trusted_device_token" 4 .IX Item "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 \f(CW\*(C`preauth\*(C'\fR endpoint. .RE .RS 4 .Sp If you are looking for the Duo \f(CW\*(C`sms\*(C'\fR factor type, use the \&\fIsend_sms_passcodes()\fR method instead. .RE .IP "auth_async(\s-1ARGS\s0)" 4 .IX Item "auth_async(ARGS)" Perform a Duo asynchronous authentication. .Sp An authentication attempt will be started for a user according to the information provided in \s-1ARGS. \s0 The return value from this call will be a Net::Duo::Admin::Async object, which provides a \fIstatus()\fR method, to get the status of the authentication, and an \fIid()\fR method, to recover the underlying transaction \s-1ID. \s0 This approach allows the application to get the authentication status at each stage, instead of receiving no information until the authentication has succeeded or failed. .Sp \&\s-1ARGS\s0 should be a reference to a hash with the same parameters as were specified for the \*(L"\fIauth()\fR\*(R" method. .IP "\fIcheck()\fR" 4 .IX Item "check()" Calls the Duo \f(CW\*(C`check\*(C'\fR endpoint. This can be used as a simple check that all of the integration arguments are correct and the client can authenticate to the Duo authentication \s-1API. \s0 On success, it returns the current time on the Duo server in seconds since \s-1UNIX\s0 epoch. .IP "send_sms_passcodes(USERNAME[, \s-1DEVICE\s0])" 4 .IX Item "send_sms_passcodes(USERNAME[, DEVICE])" Send a new batch of passcodes to the specified user via \s-1SMS. \s0 By default, the passcodes will be sent to the first SMS-capable device (the Duo \&\f(CW\*(C`auto\*(C'\fR behavior). The optional second argument specifies a device \s-1ID\s0 to which to send the passcodes. Any failure will result in an exception. .SH "AUTHOR" .IX Header "AUTHOR" Russ Allbery .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" Copyright 2014 The Board of Trustees of the Leland Stanford Junior University .PP Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \*(L"Software\*(R"), 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: .PP The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. .PP \&\s-1THE SOFTWARE IS PROVIDED \*(L"AS IS\*(R", 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.\s0 .SH "SEE ALSO" .IX Header "SEE ALSO" Duo Auth \s-1API\s0 .PP This module is part of the Net::Duo distribution. The current version of Net::Duo is available from \s-1CPAN,\s0 or directly from its web site at .