-secure => $r->{S}{encrypted_only});
}
+sub login_ok_password ($$) {
+ my ($c, $r) = @_;
+ my $username_params = $r->{S}{username_param_names};
+ my $username = $r->_ch('get_param')($username_params->[0]);
+ my $password = $r->_rp('password_param_name');
+ return $r->_ch('username_password_ok', $username, $password);
+}
+
sub do_redirect_cgi ($$$$) {
my ($c, $r, $new_url, $cookie) = @_;
my @ha = ('text/html',
get_method => sub { $_[0]->request_method() },
get_url => sub { $_[0]->url(); },
is_login => sub { defined $_[1]->_rp('password_param_name') },
- login_ok => sub { die },
+ login_ok => \&login_ok_password,
+ username_password_ok => sub { die },
is_logout => sub { $_[1]->has_a_param('logout_param_names') },
is_loggedout => sub { $_[1]->has_a_param('loggedout_param_names') },
is_page => sub { return 1 },
# fail
sub _check_divert_core ($) {
-fixme needs wrapping with something to make and commit a transaction
-wrapper should also store answers in the $r object for later retrieval
my ($r) = @_;
my $meth = $r->_ch('get_method');
--- /dev/null
+#!/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