Net::Duo::Admin::Token - Representation of a Duo token
my $decoded_json = get_json();
my $token = Net::Duo::Admin::Token->new($decoded_json);
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.
A Net::Duo::Admin::Token object is a Perl representation of a Duo token as returned by the Duo Admin API, usually via the tokens() method or nested in a user returned by the users() method. It contains various information about a token.
Creates a new token in Duo and returns the resulting token as a new Net::Duo::Admin::Token object. DUO is the Net::Duo object that should be used to perform the creation. DATA is a reference to a hash with the following keys:
The YubiKey AES key. This parameter is required for YubiKey hardware tokens.
Initial value for the HOTP counter. The default is 0. This parameter is only valid for HOTP-6 and HOTP-8 hardware tokens.
The YubiKey private ID. This parameter is required for YubiKey hardware tokens.
The HOTP secret. This parameter is required for HOTP-6 and HOTP-8 hardware tokens.
The serial number of the token. Required.
The type of hardware token. For the list of valid values, see the Duo Admin API documentation. Required.
Note that several of these keys can only be set on token creation and cannot be retrieved afterwards.
Creates a new Net::Duo::Admin::Token object from a full data set. DUO is the Net::Duo object that should be used for any further actions on this object. DATA should be the data structure returned by the Duo REST API for a single user, after JSON decoding.
Creates a new Net::Duo::Admin::Token by ID. DUO is the Net::Duo object that is used to retrieve the token from Duo and will be used for any subsequent operations. The ID should be the Duo identifier of the token. This constructor is distinguished from the previous constructor by checking whether ID is a reference.
Delete this token from Duo. After successful completion of this call, the Net::Duo::Admin::Token object should be considered read-only, since no further changes to the object can be meaningfully sent to Duo.
Convert the data stored in the object to JSON and return the results. The resulting JSON should match the JSON that one would get back from the Duo web service when retrieving the same object (plus any changes made locally to the object via set_*() methods). This is primarily intended for debugging dumps or for passing Duo objects to other systems via further JSON APIs.
The serial number of the hardware token, used to uniquely identify the hardware token when paired with type().
serial => 'simple',
token_id => 'simple',
type => 'simple',
users => 'Net::Duo::Admin::User',
The unique ID of this token as generated by Duo on token creation.
The type of token. For the list of valid values, see the Duo Admin API documentation.
The users associated with this token as a list of Net::Duo::Admin::User objects.
Russ Allbery <email@example.com>
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.
Duo Admin API for tokens
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 https://www.eyrie.org/~eagle/software/net-duo/.
To install Net::Duo, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.