From: Ian Jackson Date: Tue, 27 Oct 2015 18:48:03 +0000 (+0000) Subject: API: Expose $authreq->chain_params() X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=cgi-auth-flexible.git;a=commitdiff_plain;h=d4cf8c70946f34cc9f46f9b5fe25962df77154ba;ds=sidebyside API: Expose $authreq->chain_params() Contrary to what I said in a97dc2ce, it seems that this function is indeed useful. test/cgi wants it! Signed-off-by: Ian Jackson --- diff --git a/caf.pod b/caf.pod index 90b15db..fcb0615 100644 --- a/caf.pod +++ b/caf.pod @@ -462,6 +462,13 @@ Returns the value of the secret cookie. CGI::Auth::Flexible sets this cookie in the forms generated by C. You may also set it yourself (and indeed you must do so if you use C). +item C<< $authreq->_chain_params() >> + +Returns a hash of the "relevant" parameters to this request, in a form +suitable for C. This is all of the query +parameters which are not related to CGI::Auth::Flexible. The +PATH_INFO from the request is returned as the parameter C<< '' >>. + =back =head1 OTHER FUNCTIONS AND METHODS diff --git a/cgi-auth-flexible.pm b/cgi-auth-flexible.pm index a661618..79e12d3 100644 --- a/cgi-auth-flexible.pm +++ b/cgi-auth-flexible.pm @@ -844,7 +844,7 @@ sub _check_divert_core ($) { " enabled. You must enable cookies". " as we use them for login."), _CookieRaw => $r->_fresh_secret(), - Params => $r->_chain_params() }) + Params => $r->chain_params() }) } if (!$cookt || $cookt eq 'n' || $cookh ne $parmh) { $r->_db_revoke($cookh); @@ -862,13 +862,13 @@ sub _check_divert_core ($) { return ({ Kind => 'LOGIN-BAD', Message => $login_errormessage, _CookieRaw => $cooks, - Params => $r->_chain_params() }) + Params => $r->chain_params() }) } $r->_db_record_login_ok($parmh,$username); return ({ Kind => 'REDIRECT-LOGGEDIN', Message => $r->_gt("Logging in..."), _CookieRaw => $cooks, - Params => $r->_chain_params() }); + Params => $r->chain_params() }); } if ($cookt eq 't') { $cookt = ''; @@ -888,7 +888,7 @@ sub _check_divert_core ($) { return ({ Kind => 'LOGIN-INCOMINGLINK', Message => $r->_gt("You need to log in."), _CookieRaw => $news, - Params => $r->_chain_params() }); + Params => $r->chain_params() }); } else { $r->_db_revoke($parmh); return ({ Kind => 'LOGIN-FRESH', @@ -922,14 +922,7 @@ sub _check_divert_core ($) { return undef; } -sub _chain_params ($) { -# =item C<< $authreq->_chain_params() >> -# -# Returns a hash of the "relevant" parameters to this request, in a form -# used by C. This is all of the query parameters -# which are not related to CGI::Auth::Flexible. The PATH_INFO from the -# request is returned as the parameter C<< '' >>. - +sub chain_params ($) { my ($r) = @_; my %p = %{ $r->_ch('get_params') }; foreach my $pncn (keys %{ $r->{S} }) {