.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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 >0, 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 .\" ======================================================================== .\" .IX Title "Auth::Yubikey_WebClient 3pm" .TH Auth::Yubikey_WebClient 3pm "2022-11-19" "perl v5.36.0" "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" Auth::Yubikey_WebClient \- Authenticating the Yubikey against the Yubico Web API .SH "VERSION" .IX Header "VERSION" Version 4.02 .SH "SYNOPSIS" .IX Header "SYNOPSIS" Authenticate against the Yubico server via the Web \s-1API\s0 in Perl .PP Sample \s-1CGI\s0 script :\- .PP .Vb 1 \& #!/usr/bin/perl \& \& use CGI; \& use strict; \& \& my $cgi = new CGI; \& my $otp = $cgi\->param("otp"); \& \& print $cgi\->header(); \& print "\en"; \& print "
Yubikey :
\en"; \& \& use Auth::Yubikey_WebClient; \& \& my $id = ""; \& my $api = ""; \& my $nonce = ""; \& \& if($otp) \& { \& my $result = Auth::Yubikey_WebClient::yubikey_webclient($otp,$id,$api,$nonce); \& # result can be either ERR or OK \& \& print "Authentication result : $result
"; \& } \& \& print "\en"; .Ve .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "new" .IX Subsection "new" Creates a new Yubikey Webclient connection .PP .Vb 1 \& use Auth::Yubikey_WebClient; \& \& my $yubi = Auth::Yubikey_WebClient\->new({ \& id => , \& api => \*(Aq\*(Aq , \& nonce => \*(Aq\*(Aq, \& verify_hostname => 0 # optional \- defaults to 1. Can be set to 0 if you do not want to check the validity of the SSL certificate when querying the Yubikey server \& }); .Ve .PP You can overwrite the \s-1URL\s0 called if you want to call an alternate authentication server as well :\- .PP .Vb 1 \& use Auth::Yubikey_WebClient; \& \& my $yubi = Auth::Yubikey_WebClient\->new({ \& id => , \& api => \*(Aq\*(Aq , \& nonce => \*(Aq\*(Aq, \& url => \*(Aqhttp://www.otherserver.com/webapi.php\*(Aq \& }); .Ve .SS "debug" .IX Subsection "debug" Displays the debug info .PP .Vb 1 \& $yubi\->debug(); .Ve .PP 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 \s-1ID\s0 is, call \f(CW$yubi\fR\->{publicid}. The same goes for all the other variables printed in debug. .SS "yubikey_webclient" .IX Subsection "yubikey_webclient" .SS "otp" .IX Subsection "otp" Check a \s-1OTP\s0 for validity .PP .Vb 1 \& $result = $yubi\->otp($otp); .Ve .PP Call the otp procedure with the input from the yubikey. It will return the result. .PP This function will also setup a few internal variables that was returned from Yubico. .SH "USAGE" .IX Header "USAGE" Before you can use this module, you need to register for an \s-1API\s0 key at Yubico. This is as simple as logging onto and entering your Yubikey's \s-1OTP\s0 and your email address. Once you have the \s-1API\s0 and \s-1ID,\s0 you need to provide those details to the module to work. .SH "AUTHOR" .IX Header "AUTHOR" Phil Massyn, \f(CW\*(C`\*(C'\fR .SH "BUGS" .IX Header "BUGS" Please report any bugs or feature requests to \f(CW\*(C`bug\-auth\-yubikey_webclient at rt.cpan.org\*(C'\fR, or through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH "SUPPORT" .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Auth::Yubikey_WebClient .Ve .PP You can also look for information at: .IP "\(bu" 4 \&\s-1RT: CPAN\s0's request tracker .Sp .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .SH "Version history" .IX Header "Version history" 0.04 \- Fixed bug 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 \er bug (Thanks to Peter Norin) 3.00 \- Major update 4.01 \- 13.10.2016 \- Requested by Peter Norin \- update to use LWP::UserAgent, and the option to overwrite a valid \s-1SSL\s0 certificate (verify_hostname). The \s-1API\s0 default server is changed to ssl. 4.02 \- 2019.04.04 \- Request by Alexandre Linte \- Support for proxy servers .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2016 Phil Massyn, all rights reserved. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.