r68177 - in /branches/upstream/libauth-yubikey-webclient-perl: ./ current/ current/lib/ current/lib/Auth/ current/t/

adedommelin-guest at users.alioth.debian.org adedommelin-guest at users.alioth.debian.org
Tue Feb 8 23:31:56 UTC 2011


Author: adedommelin-guest
Date: Tue Feb  8 23:31:48 2011
New Revision: 68177

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=68177
Log:
[svn-inject] Installing original source of libauth-yubikey-webclient-perl (2.00)

Added:
    branches/upstream/libauth-yubikey-webclient-perl/
    branches/upstream/libauth-yubikey-webclient-perl/current/
    branches/upstream/libauth-yubikey-webclient-perl/current/Changes
    branches/upstream/libauth-yubikey-webclient-perl/current/MANIFEST
    branches/upstream/libauth-yubikey-webclient-perl/current/META.yml
    branches/upstream/libauth-yubikey-webclient-perl/current/Makefile.PL
    branches/upstream/libauth-yubikey-webclient-perl/current/README
    branches/upstream/libauth-yubikey-webclient-perl/current/lib/
    branches/upstream/libauth-yubikey-webclient-perl/current/lib/Auth/
    branches/upstream/libauth-yubikey-webclient-perl/current/lib/Auth/Yubikey_WebClient.pm
    branches/upstream/libauth-yubikey-webclient-perl/current/t/
    branches/upstream/libauth-yubikey-webclient-perl/current/t/00-load.t
    branches/upstream/libauth-yubikey-webclient-perl/current/t/pod-coverage.t
    branches/upstream/libauth-yubikey-webclient-perl/current/t/pod.t

Added: branches/upstream/libauth-yubikey-webclient-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/Changes?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/Changes (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/Changes Tue Feb  8 23:31:48 2011
@@ -1,0 +1,5 @@
+Revision history for Auth-Yubikey_WebClient
+
+0.01    Date/time
+        First version, released on an unsuspecting world.
+

Added: branches/upstream/libauth-yubikey-webclient-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/MANIFEST?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/MANIFEST (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/MANIFEST Tue Feb  8 23:31:48 2011
@@ -1,0 +1,9 @@
+Changes
+MANIFEST
+Makefile.PL
+README
+lib/Auth/Yubikey_WebClient.pm
+t/00-load.t
+t/pod-coverage.t
+t/pod.t
+META.yml                                 Module meta-data (added by MakeMaker)

Added: branches/upstream/libauth-yubikey-webclient-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/META.yml?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/META.yml (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/META.yml Tue Feb  8 23:31:48 2011
@@ -1,0 +1,18 @@
+--- #YAML:1.0
+name:                Auth-Yubikey_WebClient
+version:             2.00
+abstract:            Authenticating the Yubikey against the Yubico Web API
+license:             ~
+author:              
+    - Phil Massyn <phil at massyn.net>
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
+    Digest::HMAC_SHA1:             1
+    LWP::Simple:                   1
+    MIME::Base64:                  1
+    Test::More:                    0
+    URI::Escape:                   1
+meta-spec:
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Added: branches/upstream/libauth-yubikey-webclient-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/Makefile.PL?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/Makefile.PL (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/Makefile.PL Tue Feb  8 23:31:48 2011
@@ -1,0 +1,20 @@
+use strict;
+use warnings;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+    NAME                => 'Auth::Yubikey_WebClient',
+    AUTHOR              => 'Phil Massyn <phil at massyn.net>',
+    VERSION_FROM        => 'lib/Auth/Yubikey_WebClient.pm',
+    ABSTRACT_FROM       => 'lib/Auth/Yubikey_WebClient.pm',
+    PL_FILES            => {},
+    PREREQ_PM => {
+        'Test::More' => 0,
+	'LWP::Simple' => 1,
+	'MIME::Base64' => 1,
+	'Digest::HMAC_SHA1' => 1,
+	'URI::Escape' => 1
+    },
+    dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
+    clean               => { FILES => 'Auth-Yubikey_WebClient-*' },
+);

Added: branches/upstream/libauth-yubikey-webclient-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/README?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/README (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/README Tue Feb  8 23:31:48 2011
@@ -1,0 +1,52 @@
+Auth-Yubikey_WebClient
+
+The README is used to introduce the module and provide instructions on
+how to install the module, any machine dependencies it may have (for
+example C compilers and installed libraries) and any other information
+that should be provided before the module is installed.
+
+A README file is required for CPAN modules since CPAN extracts the README
+file from a module distribution so that people browsing the archive
+can use it to get an idea of the module's uses. It is usually a good idea
+to provide version information here so that people can decide whether
+fixes for the module are worth downloading.
+
+
+INSTALLATION
+
+To install this module, run the following commands:
+
+	perl Makefile.PL
+	make
+	make test
+	make install
+
+SUPPORT AND DOCUMENTATION
+
+After installing, 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
+
+    AnnoCPAN, Annotated CPAN documentation
+        http://annocpan.org/dist/Auth-Yubikey_WebClient
+
+    CPAN Ratings
+        http://cpanratings.perl.org/d/Auth-Yubikey_WebClient
+
+    Search CPAN
+        http://search.cpan.org/dist/Auth-Yubikey_WebClient
+
+
+COPYRIGHT AND LICENCE
+
+Copyright (C) 2009 Phil Massyn
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+

Added: branches/upstream/libauth-yubikey-webclient-perl/current/lib/Auth/Yubikey_WebClient.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/lib/Auth/Yubikey_WebClient.pm?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/lib/Auth/Yubikey_WebClient.pm (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/lib/Auth/Yubikey_WebClient.pm Tue Feb  8 23:31:48 2011
@@ -1,0 +1,190 @@
+package Auth::Yubikey_WebClient;
+
+use warnings;
+use strict;
+use MIME::Base64;
+use Digest::HMAC_SHA1 qw(hmac_sha1 hmac_sha1_hex);
+use LWP::Simple;
+use URI::Escape;
+
+=head1 NAME
+
+Auth::Yubikey_WebClient - Authenticating the Yubikey against the Yubico Web API
+
+=head1 VERSION
+
+Version 2.00
+
+=cut
+
+our $VERSION = '2.00';
+
+=head1 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";
+
+
+=head1 FUNCTIONS
+
+=head2 yubikey_webclient
+
+=cut
+
+sub yubikey_webclient
+{
+	my ($otp,$id,$api,$nonce) = @_;
+
+	# Generate nonce unless passed 
+	$nonce = hmac_sha1_hex(time, rand()) unless $nonce;
+
+	my $params = "id=$id&nonce=$nonce&otp=" . uri_escape($otp) . '&timestamp=1';
+	$params .= '&h=' . uri_escape(encode_base64(hmac_sha1($params, decode_base64($api)), ''));
+
+	my $response = get("http://api2.yubico.com/wsapi/2.0/verify?$params");
+
+	chomp($response);
+	if($response !~ /status=ok/i)
+	{
+		# If the status is not ok, let's not even go through the rest...
+		$response =~ m/status=(.+)/;
+		return "ERR_$1";
+	}
+
+	#extract each of the lines, and store in a hash...
+
+	my %result;	
+	foreach (split(/\n/,$response))
+	{
+		chomp;
+                if($_ =~ /=/)
+                {
+                        ($a,$b) = split(/=/,$_,2);
+                        $b =~ s/\s//g;
+                        $result{$a} = $b;
+                }
+        }
+
+        # save the h parameter, that's what we'll be comparing to
+
+        my $signatur=$result{h};
+        delete $result{h};
+        my $datastring='';
+
+				my $key;
+        foreach $key (sort keys %result)
+        {
+                $result{$key} =~ s/\s//g;
+                $datastring .= "$key=$result{$key}&";
+        }
+        $datastring = substr($datastring,0,length($datastring)-1);
+
+				# Check that nonce and OTP are the ones we asked for
+				return "ERR_MSG_AUTH" unless ($nonce eq $result{nonce} and $otp eq $result{otp});
+
+        my $hmac = encode_base64(hmac_sha1($datastring,decode_base64($api)));
+
+        chomp($hmac);
+
+        if($hmac eq $signatur)
+        {
+                return "OK";
+        }
+        else
+        {
+                return "ERR_HMAC";
+        }
+}
+
+=head1 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://api.yubico.com/yms/getapi.php> and entering your Yubikey's OTP and a brief description.  Once you have the API and ID, you need to provide those details to the module to work.
+
+=head1 AUTHOR
+
+Phil Massyn, C<< <phil at massyn.net> >>
+
+=head1 BUGS
+
+Please report any bugs or feature requests to C<bug-auth-yubikey_webclient at rt.cpan.org>, or through
+the web interface at L<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.
+
+
+
+
+=head1 SUPPORT
+
+You can find documentation for this module with the perldoc command.
+
+    perldoc Auth::Yubikey_WebClient
+
+
+You can also look for information at:
+
+=over 4
+
+=item * RT: CPAN's request tracker
+
+L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Auth-Yubikey_WebClient>
+
+=item * AnnoCPAN: Annotated CPAN documentation
+
+L<http://annocpan.org/dist/Auth-Yubikey_WebClient>
+
+=item * CPAN Ratings
+
+L<http://cpanratings.perl.org/d/Auth-Yubikey_WebClient>
+
+=item * Search CPAN
+
+L<http://search.cpan.org/dist/Auth-Yubikey_WebClient>
+
+=back
+
+=head1 Version history
+
+0.04 - Fixed bug L<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)
+
+=head1 ACKNOWLEDGEMENTS
+
+=head1 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.
+
+
+=cut
+
+1; # End of Auth::Yubikey_WebClient

Added: branches/upstream/libauth-yubikey-webclient-perl/current/t/00-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/t/00-load.t?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/t/00-load.t (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/t/00-load.t Tue Feb  8 23:31:48 2011
@@ -1,0 +1,9 @@
+#!perl -T
+
+use Test::More tests => 1;
+
+BEGIN {
+	use_ok( 'Auth::Yubikey_WebClient' );
+}
+
+diag( "Testing Auth::Yubikey_WebClient $Auth::Yubikey_WebClient::VERSION, Perl $], $^X" );

Added: branches/upstream/libauth-yubikey-webclient-perl/current/t/pod-coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/t/pod-coverage.t?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/t/pod-coverage.t (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/t/pod-coverage.t Tue Feb  8 23:31:48 2011
@@ -1,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod::Coverage
+my $min_tpc = 1.08;
+eval "use Test::Pod::Coverage $min_tpc";
+plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
+    if $@;
+
+# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
+# but older versions don't recognize some common documentation styles
+my $min_pc = 0.18;
+eval "use Pod::Coverage $min_pc";
+plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
+    if $@;
+
+all_pod_coverage_ok();

Added: branches/upstream/libauth-yubikey-webclient-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libauth-yubikey-webclient-perl/current/t/pod.t?rev=68177&op=file
==============================================================================
--- branches/upstream/libauth-yubikey-webclient-perl/current/t/pod.t (added)
+++ branches/upstream/libauth-yubikey-webclient-perl/current/t/pod.t Tue Feb  8 23:31:48 2011
@@ -1,0 +1,12 @@
+#!perl -T
+
+use strict;
+use warnings;
+use Test::More;
+
+# Ensure a recent version of Test::Pod
+my $min_tp = 1.22;
+eval "use Test::Pod $min_tp";
+plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
+
+all_pod_files_ok();




More information about the Pkg-perl-cvs-commits mailing list