NAME¶
Auth::Yubikey_WebClient - Authenticating the Yubikey against the Yubico Web API
VERSION¶
Version 3.00
SYNOPSIS¶
Authenticate against the Yubico server via the Web API in Perl
Sample CGI script :-
#!/usr/bin/perl
use CGI;
$cgi = new CGI;
$otp = $cgi->param("otp");
print "Content-type: text/html\n\n";
print "<html>\n";
print "<form method=get>Yubikey : <input type=text name=otp size=40 type=password></form>\n";
use Auth::Yubikey_WebClient;
$id = "<enter your id here>";
$api = "<enter your API key here>";
$nonce = "<enter your nonce here>";
if($otp)
{
$result = Auth::Yubikey_WebClient::yubikey_webclient($otp,$id,$api,$nonce);
# result can be either ERR or OK
print "Authentication result : <b>$result</b><br>";
}
print "</html>\n";
FUNCTIONS¶
new¶
Creates a new Yubikey Webclient connection
use Auth::Yubikey_WebClient;
my $yubi = Auth::Yubikey_WebClient->new({
id => <enter your id here> ,
api => '<enter your API key here>' ,
nonce => '<enter your nonce if you have one>'
});
You can overwrite the URL called if you want to call an alternate authentication
server as well :-
use Auth::Yubikey_WebClient;
my $yubi = Auth::Yubikey_WebClient->new({
id => <enter your id here> ,
api => '<enter your API key here>' ,
nonce => '<enter your nonce if you have one>',
url => 'http://www.otherserver.com/webapi.php'
});
debug¶
Displays the debug info
$yubi->debug();
Prints out some debug information. Useful to be called after authentication to
see what Yubico sent back. You can also call the variables yourself, for
example if you'd like to see what the token ID is, call $yubi->{publicid}.
The same goes for all the other variables printed in debug.
yubikey_webclient¶
otp¶
Check a OTP for validity
$result = $yubi->otp($otp);
Call the otp procedure with the input from the yubikey. It will return the
result.
This function will also setup a few internal variables that was returned from
Yubico.
USAGE¶
Before you can use this module, you need to register for an API key at Yubico.
This is as simple as logging onto
<
https://upgrade.yubico.com/getapikey/> and entering your Yubikey's OTP
and your email address. Once you have the API and ID, you need to provide
those details to the module to work.
AUTHOR¶
Phil Massyn, "<phil at massyn.net>"
BUGS¶
Please report any bugs or feature requests to "bug-auth-yubikey_webclient
at rt.cpan.org", or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Auth-Yubikey_WebClient
<
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Auth-Yubikey_WebClient>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
SUPPORT¶
You can find documentation for this module with the perldoc command.
perldoc Auth::Yubikey_WebClient
You can also look for information at:
- •
- RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Auth-Yubikey_WebClient
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Auth-Yubikey_WebClient>
- •
- AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Auth-Yubikey_WebClient
<http://annocpan.org/dist/Auth-Yubikey_WebClient>
- •
- CPAN Ratings
http://cpanratings.perl.org/d/Auth-Yubikey_WebClient
<http://cpanratings.perl.org/d/Auth-Yubikey_WebClient>
- •
- Search CPAN
http://search.cpan.org/dist/Auth-Yubikey_WebClient
<http://search.cpan.org/dist/Auth-Yubikey_WebClient>
Version history¶
0.04 - Fixed bug <
http://rt.cpan.org/Public/Bug/Display.html?id=51121>
1.00 - Added validation of the request to Yubico (Thanks to Kirill Miazine)
2.00 - Added nounce coding (Thanks to Ludvig af Klinteberg) 2.01 - Response
turning into an array due to \r bug (Thanks to Peter Norin)
ACKNOWLEDGEMENTS¶
COPYRIGHT & LICENSE¶
Copyright 2010 Phil Massyn, all rights reserved.
This program is free software; you can redistribute it and/or modify it under
the same terms as Perl itself.