Apache2-AuthenSecurID
view release on metacpan or search on metacpan
Auth/Auth.pm view on Meta::CPAN
PeerPort => $ace_initd_port,
Proto => 'udp'
);
my %ACE;
my $request;
my $message;
my $extra_input;
if ( ( !$username && !$passcode )
|| ( $type ne "pin" && !$passcode )
|| ( $passcode =~ /\:/ ) )
{
$message = qq{
Please enter your username and passcode<br/>
Your passcode is your 4 - 8 digit pin plus<br/>
6 digit SecurID code. If you do not have<br/>
a PIN yet just enter the 6 digit SecurID code.
};
$extra_input = qq{
<label for="passcode">Passcode :</label>
<input type="password" name="passcode" id="passcode"/>
<input type="hidden" name="type" value="check"/>
<input type="hidden" name="a" value="$uri"/>
};
}
else {
if ( $type eq "pin" ) {
( $passcode, $message, $extra_input ) = check_pin( $r, $req );
if ($passcode) {
( $message, $extra_input ) =
Do_ACE( $username, $passcode, $type, $session_id, $client, $r, $req );
}
}
else {
( $message, $extra_input ) =
Do_ACE( $username, $passcode, $type, $session_id, $client, $r, $req );
}
}
my $head = qq|
<body>
<head>
<title>SecurID Authentication</title>
<style>
label {
font-family: monospace;
}
p {
font-family: sans-serif;
margin-left: auto;
margin-right: auto;
}
</style>
</head>
<html>
<!-- $session_id -->
<form method="post">
<fieldset style="width: 500px; margin-left: auto; margin-right: auto; background: #cccccc;">
<legend>SecurID Authorization</legend>
<p>$message</p>
<br/>
<label for="username">Username :</label>
<input type="text" name="username" value="$username" id="username"/>
<br/>
$extra_input
<br/>
<br/>
<input type="submit" name="Submit" value="Enter"/>
<input type="reset" name="reset"/>
<br/>
</fieldset>
</form>
</html>
|;
$r->content_type('text/html');
#$r->send_http_header;
$r->print($head);
return Apache2::Const::OK;
}
sub check_pin {
my ( $r, $req ) = @_;
my $pin1 = $req->param('pin1');
my $pin2 = $req->param('pin2');
my $alphanumeric = $req->param('alphanumeric');
my $min_pin_len = $req->param('min_pin_len');
my $max_pin_len = $req->param('max_pin_len');
my $uri = $req->param('a');
my $message;
my $extra_info = qq{
<span style="font-weight: bold;">User Authenticated</span>
<label for="pin1">PIN :</label>
<input type="password" name="pin1" id="pin1"/>
<input type="hidden" name="type" value="pin"/>
<input type="hidden" name="a" value="$uri"/>
<input type="hidden" name="alphanumeric" value="$alphanumeric"/>
<input type="hidden" name="min_pin_len" value="$min_pin_len"/>
<input type="hidden" name="max_pin_len" value="$max_pin_len"/>
<label for="pin1">PIN ( Again ) :</label>
<input type="password" name="pin2" id="pin2"/>
};
if ( $pin1 != $pin2 ) {
$message = qq{
<span style="font-weight: bold;">New Pin Required</span>
<p>
Pins do not match!!
</p>
<p>
Please enter a $min_pin_len to $max_pin_len digit pin.
</p>
};
return ( 0, $message, $extra_info );
( run in 1.479 second using v1.01-cache-2.11-cpan-39bf76dae61 )