Authen-ACE

 view release on metacpan or  search on metacpan

eg/simple-auth  view on Meta::CPAN

#! /ipl/perl5/bin/perl

# Example of doing simple authentication if at a TTY. This program
# will handle all parts of the ACE authentication, including setting a
# new PIN or demanding multiple tokens.

use Authen::ACE;

$ace = new Authen::ACE;

$username = $ARGV[0]? $ARGV[0] : (getpwuid($>))[0];

($result,$shell) = $ace->Auth($username);

print "${username}'s default shell is $shell\n" if $result == ACM_OK;

test.pl  view on Meta::CPAN


print "Enter an invalid PIN/token for your SecurID card. ";
($result,$shell) = $ace->Auth();
printok($testno++, $result == ACM_ACCESS_DENIED, 
	"expected `access denied' from Authen::ACE::Auth");

print "Enter the PIN+token for ${testuser}'s SecurID card. ";
($result, $shell) = $ace->Auth($testuser);
printok($testno++, $result == ACM_OK, "failed Authen::ACE::Auth for $testuser");

$username = (getpwuid($<))[0];
print "Wait for your SecurID card's token to change; press Enter to continue "; <>;
print "Re-enter the PIN+token for your SecurID card: ";
ReadMode(2);
$pass = <>;
ReadMode(0);
print "\n";
chomp $pass;
($result,$shell) = $ace->Check($pass, $username);
printok($testno++, $result == ACM_OK, "failed Authen::ACE::Check");
printok($testno++, $shell == $myshell, "unexpected shell $shell");

test.pl  view on Meta::CPAN

  $ans = <>; chomp $ans;
  $myshell = $ans unless $ans eq "";

  print "Enter the username of user to use for the PIN setting tests";
  print " [$pinuser] (NONE to disable)" if $pinuser ne "";
  print ": ";
  $ans = <>; chomp $ans;
  $pinuser = $ans unless $ans eq "";
  $pinuser = "" if $ans eq "NONE";

  $testuser = ($pinuser eq "")? (getpwuid($>))[0] : $pinuser;
  print "Enter the username to use for the named user tests";
  print " [$testuser]" if $testuser ne "";
  print ": ";
  $ans = <>; chomp $ans;
  $testuser = $ans unless $ans eq "";

  if (open(TP, ">.testparms")) {
    print TP "\$myshell = \"$myshell\";\n";
    print TP "\$testuser = \"$testuser\";\n";
    print TP "\$pinuser = \"$pinuser\";\n";



( run in 0.459 second using v1.01-cache-2.11-cpan-8d75d55dd25 )