+ httpauth_pagespec => {
+ type => "pagespec",
+ example => "!*/Discussion",
+ description => "PageSpec of pages where only httpauth will be used for authentication",
+ safe => 0,
+ rebuild => 0,
+ },
+}
+
+sub checkconfig () {
+ if ($config{cgi} && defined $config{cgiauthurl} &&
+ keys %{$IkiWiki::hooks{auth}} < 2) {
+ # There are no other auth hooks registered, so avoid
+ # the normal signin form, and jump right to httpauth.
+ require IkiWiki::CGI;
+ inject(name => "IkiWiki::cgi_signin", call => sub ($$) {
+ my $cgi=shift;
+ redir_cgiauthurl($cgi, $cgi->query_string());
+ });
+ }
+}
+
+sub redir_cgiauthurl ($;@) {
+ my $cgi=shift;
+
+ IkiWiki::redirect($cgi,
+ @_ > 1 ? IkiWiki::cgiurl(cgiurl => $config{cgiauthurl}, @_)
+ : $config{cgiauthurl}."?@_"
+ );
+ exit;