AnyEvent-Yubico
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/AnyEvent/Yubico.pm view on Meta::CPAN
As an alternative, you can call verify_async, which will return a condition
variable immediately. This can be used if your application already uses an
asynchronous model. You can also pass a callback as a second parameter to
verify as well as verify_async, which will be invoked once validation has
completed, with the result.
$result_cv = $yk->verify_async('<YubiKey OTP here>', sub {
#Callback invoked when verification is done
$result_details = shift;
if($result_details->{status} eq 'OK') ...
});
#Wait for the result (blocking, same as calling verify directly).
$result_details = $result_cv->recv;
=head1 DESCRIPTION
Validates a YubiKey OTP (One Time Password) using the YKVAL 2.0 protocol as
defined here: https://github.com/Yubico/yubikey-val/wiki/ValidationProtocolV20
To use this module, an API key is required, which can be requested here:
https://upgrade.yubico.com/getapikey/
When creating the AnyEvent::Yubico instance, the following arguments can be passed:
=over 4
=item client_id = $id_int
Required. The client ID corresponding to the API key.
=item api_key => $api_key_string
Optional. The API key used to sign requests and verify responses. Without
this response signatures won't be verified.
=item urls => $array_of_urls
Optional. Defines which validation server URLs to query. The default uses
the public YubiCloud validation servers. Must support version 2.0 of the
validation protocol.
Example:
$yk = AnyEvent::Yubico->new({
client_id => ...,
api_key => ...,
urls => [
"http://example.com/wsapi/2.0/verify",
"http://127.0.0.1/wsapi/2.0/verify"
]
});
=item sign_requests => $enable
Optional. When enabled (enabled by default) requests will be signed, as long
as api_key is also provided.
=item timeout => $seconds
Optional. Timeout parameter sent to the server, see the protocol details for
more information.
=item sl => $level
Optional. Security level parameter sent to the server, see the protocol
details for more information.
=item timestamp => $enable
Optional. When enabled, sends the timestamp parameter to the server, causing
YubiKey counter and timestamp information to be returned in the response.
=item local_timeout => $seconds
Optional. Sets the local timeout for how long the verify method will wait
until failing. The default is 30 seconds.
=back
=head1 SEE ALSO
The Yubico Validation Protocol 2.0 specification:
https://github.com/Yubico/yubikey-val/wiki/ValidationProtocolV20
More information about the YubiKey:
http://www.yubico.com
=head1 AUTHOR
Dain Nilsson, E<lt>dain@yubico.comE<gt>
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2013 Yubico AB
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.401 second using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )