Authen-ACE4
view release on metacpan or search on metacpan
=pod
=head1 NAME
Authen::ACE4 - Perl extension for accessing a SecurID ACE server or RSA Authenticaiotn Manager
=head1 SYNOPSIS
use Authen::ACE4;
AceInitialize();
($result, $handle, $moreData, $echoFlag, $respTimeout,
$nextRespLen, $prompt)
= AceStartAuth($username);
($result, $moreData, $echoFlag, $respTimeout,
$nextRespLen, $prompt)
= Authen::ACE4::AceContinueAuth($handle, $resp);
($result, $status)
= Authen::ACE4::AceGetAuthenticationStatus($handle);
$result = AceCloseAuth($handle);
=head1 DESCRIPTION
Authen::ACE4 provides a client interface to a Security Dynamics SecurID
ACE server. It uses the ACE/Agent client libraries.
contact the ACE server and/or Authentication Manager. The
default is /var/ace/data. If your sdconf.rec is in a different location
you must specify VAR_ACE eg:
$ENV{VAR_ACE} = '/opt/ace/data';
before calling AceInitialize.
=item AceStartAuth
($result, $handle, $moreData, $echoFlag, $respTimeout,
$nextRespLen, $prompt)
= Authen::ACE4::AceStartAuth($username);
The AceStartAuth function is designed to be used aling with
AceContinueAuth and AceCloseAuth.
AceStartAuth is the first step in authenticating a user. If the
function returns successfully, continue to call AceContinueAuth as
long as $moreData is true.
=item moreData
A flag that indicate whether more data is needed by the
authentication context.
=item echoFlag
A flag that gives a hint to the developer whether the next response
should be echoed on the screen.
=item respTimeout
A hint to the developer about how long to display this prompt
string to the user.
=item nextRespLen
Indicates the maximum number of bytes of data expected in the next
call to AceContinueAuth
=item prompt
Message string that should be shown to the user as the request for
data to be passed to the next call to AceContinueAuth.
=back
=item AceContinueAuth
($result, $moreData, $echoFlag, $respTimeout,
$nextRespLen, $prompt)
= Authen::ACE4::AceContinueAuth($handle, $resp);
AceContinueAuth should continue to be called for as long as
it succeeds and $moreData is true. Each successive call will
ask for additional data required for the authentication to be
entered by the user.
After AceContinueAuth returns with moreDat false, use
=item moreData
A flag that indicate whether more data is needed by the
authentication context.
=item echoFlag
A flag that gives a hint to the developer whether the next response
should be echoed on the screen.
=item respTimeout
A hint to the developer about how long to display this prompt
string to the user.
=item nextRespLen
Indicates the maximum number of bytes of data expected in the next
call to AceContinueAuth
=item prompt
void
AceStartAuth(userID)
char* userID
PPCODE:
STRLEN userIDLen;
SDI_HANDLE handle;
SD_BOOL moreData;
SD_BOOL echoFlag;
SD_I32 respTimeout;
SD_I32 nextRespLen;
char promptStr[512];
SD_I32 promptStrLen = sizeof(promptStr);
SD_ERROR result;
// Need the real length of the string
userID = (char *)SvPV(ST(0), userIDLen);
result = AceStartAuth(&handle, userID, userIDLen,
&moreData, &echoFlag, &respTimeout,
&nextRespLen, promptStr, &promptStrLen);
// Always push the result, and, if successful
// the rest
EXTEND(sp, 5);
PUSHs(sv_2mortal(newSViv(result)));
PUSHs(sv_2mortal(newSViv(handle)));
PUSHs(sv_2mortal(newSViv(moreData)));
PUSHs(sv_2mortal(newSViv(echoFlag)));
PUSHs(sv_2mortal(newSViv(respTimeout)));
PUSHs(sv_2mortal(newSViv(nextRespLen)));
PUSHs(sv_2mortal(newSVpv(promptStr, strlen(promptStr))));
void
AceContinueAuth(handle, resp)
int handle
char* resp
PPCODE:
STRLEN respLen;
SD_BOOL moreData;
SD_BOOL echoFlag;
SD_I32 respTimeout;
SD_I32 nextRespLen;
char promptStr[512];
SD_I32 promptStrLen = sizeof(promptStr);
SD_ERROR result;
// Need the real length of the string
resp = (char *)SvPV(ST(1), respLen);
result = AceContinueAuth(handle, resp, respLen,
&moreData, &echoFlag, &respTimeout,
&nextRespLen, promptStr, &promptStrLen);
// Always push the result, and, if successful
// the rest
EXTEND(sp, 5);
PUSHs(sv_2mortal(newSViv(result)));
EXTEND(sp, 4);
PUSHs(sv_2mortal(newSViv(moreData)));
PUSHs(sv_2mortal(newSViv(echoFlag)));
PUSHs(sv_2mortal(newSViv(respTimeout)));
PUSHs(sv_2mortal(newSViv(nextRespLen)));
// Sigh: promptStrLen is unreliable with the 6.1 SDK and AM 7.1
PUSHs(sv_2mortal(newSVpv(promptStr, strlen(promptStr))));
int
AceGetAuthenticationStatus(handle)
int handle
PPCODE:
eg/simple.pl view on Meta::CPAN
use Authen::ACE4;
my $username = 'mikem';
Authen::ACE4::AceInitialize();
print "Enter Username:\n";
$username = <>;
chomp $username;
($result, $handle, $moreData, $echoFlag, $respTimeout, $nextRespLen, $prompt) = Authen::ACE4::AceStartAuth($username);
die "AceStartAuth failed: $prompt\n"
unless $result == Authen::ACE4::ACM_OK;
while ($moreData)
{
print "$prompt\n";
$resp = <>;
chomp $resp;
($result, $moreData, $echoFlag, $respTimeout, $nextRespLen, $prompt) = Authen::ACE4::AceContinueAuth($handle, $resp);
die "AceContinueAuth failed: $prompt\n"
unless $result == Authen::ACE4::ACM_OK;
}
print "$prompt\n";
($result, $status) = Authen::ACE4::AceGetAuthenticationStatus($handle);
# If $result is ACE_SUCCESS, then $status is defined, and
# indicates ACM_OK, ACM_ACCESS_DENIED etc
# on Unix, you may have a non-stanrard path to
# your sdconf.rec. Ttry setting the VAR_ACE environment variable
# to the correct path to your data directory
Authen::ACE4::AceInitialize();
printok($testno++, 1, 'failed to initialize');
print "enter a SecurID username to test with:\n";
$username = <>;
chomp $username;
($result, $handle, $moreData, $echoFlag, $respTimeout,
$nextRespLen, $prompt)
= Authen::ACE4::AceStartAuth($username);
printok($testno++, $result == ACM_OK, "AceStartAuth failed: $prompt");
while ($moreData)
{
print "$prompt\n";
$resp = <>;
chomp $resp;
($result, $moreData, $echoFlag, $respTimeout,
$nextRespLen, $prompt)
= Authen::ACE4::AceContinueAuth($handle, $resp);
printok($testno++, $result == ACM_OK, "AceContinueAuth failed: $prompt");
}
($result, $status) = Authen::ACE4::AceGetAuthenticationStatus($handle);
# If $result is ACE_SUCCESS, then $status is defined, and
# indicates ACM_OK, ACM_ACCESS_DENIED etc
printok($testno++, $result == ACE_SUCCESS, 'AceGetAuthenticationStatus failed');
( run in 0.273 second using v1.01-cache-2.11-cpan-4d50c553e7e )