chiark / gitweb /
wip testing
[cgi-auth-flexible.git] / test.cgi
diff --git a/test.cgi b/test.cgi
new file mode 100755 (executable)
index 0000000..635d85a
--- /dev/null
+++ b/test.cgi
@@ -0,0 +1,32 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use CGI;
+
+my $verifier = CGI::Auth::Hybrid->new_verifier(
+   assocdb_path => '/u/iwj/work/Ssh-gateway/cgi-auth-hybrid.git/dump',
+   username_password_ok => sub { my ($c,$r,$u,$p)=@_; return $p eq 'sesame'; },
+);
+
+my $q = CGI->new;
+
+my $authreq = $verifier->new_request($q);
+
+$authreq->check_ok() or return;
+
+my $cookie = $authreq->secret_cookie();
+my $url = url();
+my $hiddenhtml = $authoreq->secret_hidden_html();
+
+print <<END;
+Content-Type: text/html
+Set-Cookie: $cookie
+
+<html><head><title>TITLE</title></head>
+<body><h1>H1</h1>
+<h1>again</h1>
+
+<form method="POST" action="$url">
+$hiddenhtml
+END