[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: Fwd: modperl Digest 16 Jun 2017 08:02:57 -0000 Issue 3266
From: Cris Shupp <cshupp () gmail ! com>
Date: 2017-06-16 17:44:40
Message-ID: CA+gaLa0KSeXnET_VKS_=6NzGj5wXHCj0kFGv7coF_v2jArpGZA () mail ! gmail ! com
[Download RAW message or body]
André,
Thank you for your response! I had to read your post multiple times (your
magic sentences):
---
No further "response generator" will be called for this request (such as
any "Ruby on Rails" module which might then have seen these response
headers).
(In other words : I think that your headers /are/ being set; but that there
is nothing that runs afterward to show you that they are set.)
---
I couldn't figure out why you would think I couldn't tell if my Rails code
was being hit. I mean I am dense, but... He thinks I know what I am doing
in my perl...
OK, I did this:
$r->headers_out->set('prisme-roles'=> $role_string );
Should of done:
$r->headers_in->set('prisme-roles'=> $role_string );
I also put in more logging in my Rails controller, and it is a good thing I
did (I never would have seen my header on the web page)...
"prisme-roles" is transformed to "HTTP_PRISME_ROLES"
BTW, I am configured as a PerlFixupHandler, and it has always allowed a
return of FORBIDEN.
I tried (per your suggestion) using: PerlAuthenHandler
but that doesn't work. My mod perl module seems to not even run in that
case.
Thanks,
Cris
On Fri, Jun 16, 2017 at 4:02 AM, <modperl-digest-help@perl.apache.org>
wrote:
>
> modperl Digest 16 Jun 2017 08:02:57 -0000 Issue 3266
>
> Topics (messages 64692 through 64693)
>
> Re: lost headers
> 64692 by: Cris Shupp
> 64693 by: André Warnier (tomcat)
>
> Administrivia:
>
> ---------------------------------------------------------------------
> To post to the list, e-mail: modperl@perl.apache.org
> To unsubscribe, e-mail: modperl-digest-unsubscribe@perl.apache.org
> For additional commands, e-mail: modperl-digest-help@perl.apache.org
>
> ----------------------------------------------------------------------
>
>
>
> ---------- Forwarded message ----------
> From: Cris Shupp <cshupp@gmail.com>
> To: modperl@perl.apache.org
> Cc:
> Bcc:
> Date: Tue, 13 Jun 2017 12:54:14 -0400
> Subject: Re: lost headers
> Hello all...
>
> I have a simple mod_perl program that does some custom role based
> authentication before granting access to certain resources. That part does
> work, but for a new feature I need to be able to embed roles into my
> headers. Try as may, try as I might, those roles never show up...
>
>
> consider a portion of my mod_perl program:
>
> #####################
> sub handler {
> ...
> if($user) {
> my $val = rest_call($user,$context, $r->log);
> my $roles = $cache_hash{'roles'}->{$user};
> my $role_string = join(',', @$roles);
> $r->headers_out->set('prisme-roles'=> $role_string );
> #$r->headers_out->add('prisme.roles'=> $role_string );
> $r->err_headers_out->add('prisme-roles2', $role_string);
> #$|++;
> $r->rflush();# $r->rflush can't be called before the response
> phase if using PerlFixupHandler Prisme::ValidateHeader
> $r->log->info("Request end on pid $$: The user for this request is
> $user, the roles are $role_string, returning $val");
> return $val; #OK or FORBIDDEN
> }
> ###################################
>
> With either config in http.conf:
> ##############################
> <Location /rails_prisme/>
> SetHandler perl-script
> PerlResponseHandler Prisme::ValidateHeader
> #PerlFixupHandler Prisme::ValidateHeader
> </Location>
> ####################
>
>
> My Ruby on Rails controller:
> #######################
> def warmup
> @headers = {}
> @warmup_count = $PROPS['PRISME.warmup_apache'].to_i
> request.headers.each do |elem|
> @headers[elem.first.to_s] = elem.last.to_s
> end
> response.headers.each do |elem|
> @headers[elem.first.to_s] = elem.last.to_s
> end
> respond_to do |format|
> format.html # list_headers.html.erb
> format.json { render :json => params['counter'] }
> end
> end
> #######################
>
>
> Never sees those headers! Help!
>
> Thanks,
>
> Cris
>
>
> On Tue, Jun 13, 2017 at 12:52 PM, Cris Shupp <cshupp@gmail.com> wrote:
>
>> Hello all...
>>
>> I have a simple mod_perl program that does some custom role based
>> authentication before granting access to certain resources. That part does
>> work, but for a new feature I need to be able to embed roles into my
>> headers. Try as may, try as I might, those roles never show up...
>>
>>
>> consider a portion of my mod_perl program:
>>
>> sub handler {
>> ...
>> if($user) {
>> my $val = rest_call($user,$context, $r->log);
>> my $roles = $cache_hash{'roles'}->{$user};
>> my $role_string = join(',', @$roles);
>> $r->headers_out->set('prisme-roles'=> $role_string );
>> #$r->headers_out->add('prisme.roles'=> $role_string );
>> $r->err_headers_out->add('prisme-roles2', $role_string);
>> #$|++;
>> $r->rflush();# $r->rflush can't be called before the response
>> phase if using PerlFixupHandler Prisme::ValidateHeader
>> $r->log->info("Request end on pid $$: The user for this request
>> is $user, the roles are $role_string, returning $val");
>> return $val; #OK or FORBIDDEN
>> }
>>
>> With either config in http.conf:
>>
>> <Location /rails_prisme/>
>> SetHandler perl-script
>> PerlResponseHandler Prisme::ValidateHeader
>> #PerlFixupHandler Prisme::ValidateHeader
>> </Location>
>>
>> My Ruby on Rails controller:
>>
>>
>>
>>
>
>
> ---------- Forwarded message ----------
> From: "André Warnier (tomcat)" <aw@ice-sa.com>
> To: modperl@perl.apache.org
> Cc:
> Bcc:
> Date: Wed, 14 Jun 2017 11:32:58 +0200
> Subject: Re: lost headers
> Hi.
> To avoid another round of questions/answers, it would be better to provide
> some versions of what you are using, right away.
> One quick way of doing this, is to insert here the line which appears in
> your Apache webserver main error logfile at startup.
> It shows the Apache httpd version, the version of perl, and the version of
> mod_perl.
>
> Secondly, in your explanation below, it is not very clear when/if your
> "Ruby on Rails controller" is even called.
>
> You are seting this in the Apache httpd configuration :
>
> <Location /rails_prisme/>
> SetHandler perl-script
> PerlResponseHandler Prisme::ValidateHeader
> </Location>
>
> That means that mod_perl (and the Prisme::ValidateHeader mod_perl module)
> are effectively, for Apache, the code which generates the HTTP response to
> this request.
> No further "response generator" will be called for this request (such as
> any "Ruby on Rails" module which might then have seen these response
> headers).
>
> (In other words : I think that your headers /are/ being set; but that
> there is nothing that runs afterward to show you that they are set.)
>
> Configuring your module as a PerlFixupHandler (*and* dropping the
> "SetHandler perl-script") would avoid this. But in such a handler, you can
> only return "OK" or "DECLINED" (and not "FORBIDDEN"), see :
> http://perl.apache.org/docs/2.0/user/handlers/intro.html#Stacked_Handlers
>
> Personally however, considering that this seems to be a part of an AAA
> phase, I would make adding this header as either a part of the
> already-existing Perl Authentication module, or configure your perl module
> as a PerlAuthenHandler.
> (In that case also, you /can/ return FORBIDDEN).
>
>
>
> On 13.06.2017 18:54, Cris Shupp wrote:
>
>> Hello all...
>>
>> I have a simple mod_perl program that does some custom role based
>> authentication before
>> granting access to certain resources. That part does work, but for a new
>> feature I need
>> to be able to embed roles into my headers. Try as may, try as I might,
>> those roles never
>> show up...
>>
>>
>> consider a portion of my mod_perl program:
>>
>> #####################
>> sub handler {
>> ...
>> if($user) {
>> my $val = rest_call($user,$context, $r->log);
>> my $roles = $cache_hash{'roles'}->{$user};
>> my $role_string = join(',', @$roles);
>> $r->headers_out->set('prisme-roles'=> $role_string );
>> #$r->headers_out->add('prisme.roles'=> $role_string );
>> $r->err_headers_out->add('prisme-roles2', $role_string);
>> #$|++;
>> $r->rflush();# $r->rflush can't be called before the response
>> phase if using
>> PerlFixupHandler Prisme::ValidateHeader
>> $r->log->info("Request end on pid $$: The user for this request
>> is $user, the
>> roles are $role_string, returning $val");
>> return $val; #OK or FORBIDDEN
>> }
>> ###################################
>>
>> With either config in http.conf:
>> ##############################
>> <Location /rails_prisme/>
>> SetHandler perl-script
>> PerlResponseHandler Prisme::ValidateHeader
>> #PerlFixupHandler Prisme::ValidateHeader
>> </Location>
>> ####################
>>
>>
>> My Ruby on Rails controller:
>> #######################
>> def warmup
>> @headers = {}
>> @warmup_count = $PROPS['PRISME.warmup_apache'].to_i
>> request.headers.each do |elem|
>> @headers[elem.first.to_s] = elem.last.to_s
>> end
>> response.headers.each do |elem|
>> @headers[elem.first.to_s] = elem.last.to_s
>> end
>> respond_to do |format|
>> format.html # list_headers.html.erb
>> format.json { render :json => params['counter'] }
>> end
>> end
>> #######################
>>
>>
>> Never sees those headers! Help!
>>
>> Thanks,
>>
>> Cris
>>
>>
>> On Tue, Jun 13, 2017 at 12:52 PM, Cris Shupp <cshupp@gmail.com <mailto:
>> cshupp@gmail.com>>
>> wrote:
>>
>> Hello all...
>>
>> I have a simple mod_perl program that does some custom role based
>> authentication
>> before granting access to certain resources. That part does work,
>> but for a new
>> feature I need to be able to embed roles into my headers. Try as
>> may, try as I might,
>> those roles never show up...
>>
>>
>> consider a portion of my mod_perl program:
>>
>> sub handler {
>> ...
>> if($user) {
>> my $val = rest_call($user,$context, $r->log);
>> my $roles = $cache_hash{'roles'}->{$user};
>> my $role_string = join(',', @$roles);
>> $r->headers_out->set('prisme-roles'=> $role_string );
>> #$r->headers_out->add('prisme.roles'=> $role_string );
>> $r->err_headers_out->add('prisme-roles2', $role_string);
>> #$|++;
>> $r->rflush();# $r->rflush can't be called before the
>> response phase if using
>> PerlFixupHandler Prisme::ValidateHeader
>> $r->log->info("Request end on pid $$: The user for this
>> request is $user, the
>> roles are $role_string, returning $val");
>> return $val; #OK or FORBIDDEN
>> }
>>
>> With either config in http.conf:
>>
>> <Location /rails_prisme/>
>> SetHandler perl-script
>> PerlResponseHandler Prisme::ValidateHeader
>> #PerlFixupHandler Prisme::ValidateHeader
>> </Location>
>>
>> My Ruby on Rails controller:
>>
>>
>>
>>
>>
>
>
>
[Attachment #3 (text/html)]
<div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div><span \
style="font-size:16px">André,</span><span \
style="font-size:16px"><br></span></div><div><span \
style="font-size:16px"><br></span></div><div><span style="font-size:16px">Thank you \
for your response! I had to read your post multiple times (your magic \
sentences):</span></div><span style="font-size:16px"><div><span \
style="font-size:16px"><br></span></div><div><span \
style="font-size:16px">---</span></div><div>No further "response generator" \
will be called for this request (such as any "Ruby on Rails" module which \
might then have seen these response headers).<span \
style="font-size:16px"><br></span></div>(In other words : I think that your headers \
/are/ being set; but that there is nothing that runs afterward to show you that they \
are set.)</span><br><div><span style="font-size:16px">---</span></div><div><span \
style="font-size:16px"><br></span></div><div><span style="font-size:16px">I \
couldn't figure out why you would think I couldn't tell if my Rails code was \
being hit. I mean I am dense, but... He thinks I know what I am doing in my \
perl...</span></div><div><span style="font-size:16px"><br></span></div><div><span \
style="font-size:16px">OK, I did this:</span></div><div><span \
style="font-size:16px"><br></span></div><div><span style="font-size:16px"> \
$r->headers_out->set('prisme-</span><span \
style="font-size:16px"><wbr>roles'=> $role_string );</span><br \
style="font-size:16px"></div><div><span style="font-size:16px">Should of \
done:</span></div><div><span style="font-size:16px"> \
$r->headers_in->set('prisme-</span><span \
style="font-size:16px">r<wbr>oles'=> $role_string );</span><br \
style="font-size:16px"></div><div><span \
style="font-size:16px"><br></span></div><div><span style="font-size:16px">I also put \
in more logging in my Rails controller, and it is a good thing I did (I never would \
have seen my header on the web page)...</span></div><div><span \
style="font-size:16px"><br></span></div><div><span \
style="font-size:16px">"prisme-roles" is transformed to \
"HTTP_PRISME_ROLES"</span></div><div><span \
style="font-size:16px"><br></span></div><div><span \
style="font-size:16px"><br></span></div><div><span style="font-size:16px">BTW, I am \
configured as a </span><span style="font-size:16px">PerlFixupHandler, and it has \
always allowed a return of FORBIDEN.</span></div><div><span \
style="font-size:16px"><br></span></div><div><span style="font-size:16px">I tried \
(per your suggestion) using: </span><span \
style="color:rgb(0,0,0);font-family:"courier \
new",courier,monospace;font-size:medium">PerlAuthenHandler</span></div><div><span \
style="color:rgb(0,0,0);font-family:"courier \
new",courier,monospace;font-size:medium"><br></span></div><div><span \
style="font-size:16px">but that doesn't work. My mod perl module seems to not \
even run in that case.</span></div><div><span \
style="color:rgb(0,0,0);font-family:"courier \
new",courier,monospace;font-size:medium"><br></span></div><div><span \
style="color:rgb(0,0,0);font-family:"courier \
new",courier,monospace;font-size:medium"><br></span></div><div><span \
style="color:rgb(0,0,0);font-family:"courier \
new",courier,monospace;font-size:medium">Thanks,</span></div><div><span \
style="color:rgb(0,0,0);font-family:"courier \
new",courier,monospace;font-size:medium"><br></span></div><div><span \
style="color:rgb(0,0,0);font-family:"courier \
new",courier,monospace;font-size:medium">Cris \
</span><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div \
class="h5">On Fri, Jun 16, 2017 at 4:02 AM, <span dir="ltr"><<a \
href="mailto:modperl-digest-help@perl.apache.org" \
target="_blank">modperl-digest-help@perl.<wbr>apache.org</a>></span> \
wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div \
class="h5"><br> modperl Digest 16 Jun 2017 08:02:57 -0000 Issue 3266<br>
<br>
Topics (messages 64692 through 64693)<br>
<br>
Re: lost headers<br>
64692 by: Cris Shupp<br>
64693 by: André Warnier (tomcat)<br>
<br>
Administrivia:<br>
<br>
------------------------------<wbr>------------------------------<wbr>---------<br>
To post to the list, e-mail: <a href="mailto:modperl@perl.apache.org" \
target="_blank">modperl@perl.apache.org</a><br> To unsubscribe, e-mail: <a \
href="mailto:modperl-digest-unsubscribe@perl.apache.org" \
target="_blank">modperl-digest-unsubscribe@per<wbr>l.apache.org</a><br> For \
additional commands, e-mail: <a href="mailto:modperl-digest-help@perl.apache.org" \
target="_blank">modperl-digest-help@perl.apach<wbr>e.org</a><br> <br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
<br><br></div></div>---------- Forwarded message ----------<br>From: Cris Shupp \
<<a href="mailto:cshupp@gmail.com" target="_blank">cshupp@gmail.com</a>><br>To: \
<a href="mailto:modperl@perl.apache.org" \
target="_blank">modperl@perl.apache.org</a><br>Cc: <br>Bcc: <br>Date: Tue, 13 Jun \
2017 12:54:14 -0400<br>Subject: Re: lost headers<br><div dir="ltr"><span \
style="font-size:16px">Hello all...</span><div style="font-size:16px"><br></div><div \
style="font-size:16px">I have a simple mod_perl program that does some custom role \
based authentication before granting access to certain resources. That part does \
work, but for a new feature I need to be able to embed roles into my headers. Try \
as may, try as I might, those roles never show up...</div><div \
style="font-size:16px"><br></div><div style="font-size:16px"><br></div><div \
style="font-size:16px">consider a portion of my mod_perl program:</div><div \
style="font-size:16px"><br></div><div \
style="font-size:16px">#####################</div><div style="font-size:16px">sub \
handler {<br></div><div style="font-size:16px">...</div><div \
style="font-size:16px"><div>if($user) {</div><div> my $val = \
rest_call($user,$context, $r->log);</div><div> my $roles = \
$cache_hash{'roles'}->{$user};</div><div> my $role_string = \
join(',', @$roles);</div><div> \
$r->headers_out->set('prisme-r<wbr>oles'=> $role_string \
);</div><div> #$r->headers_out->add('prisme.<wbr>roles'=> \
$role_string );</div><div> \
$r->err_headers_out->add('pris<wbr>me-roles2', \
$role_string);</div><div> #$|++;</div><div> $r->rflush();# \
$r->rflush can't be called before the response phase if using PerlFixupHandler \
Prisme::ValidateHeader</div><div> $r->log->info("Request end on \
pid $$: The user for this request is $user, the roles are $role_string, returning \
$val");</div><div> return $val; #OK or FORBIDDEN</div><div> \
}</div></div><div style="font-size:16px">##############################<wbr>#####</div><div \
style="font-size:16px"><br></div><div style="font-size:16px">With either config in \
http.conf:</div><div style="font-size:16px">##############################</div><div \
style="font-size:16px"><div><Location /rails_prisme/></div><div> SetHandler \
perl-script</div><div> PerlResponseHandler Prisme::ValidateHeader</div><div> \
#PerlFixupHandler Prisme::ValidateHeader</div><div></Location></div></div><div \
style="font-size:16px">####################</div><div \
style="font-size:16px"><br></div><div style="font-size:16px"><br></div><div \
style="font-size:16px">My Ruby on Rails controller:</div><div \
style="font-size:16px">#######################</div><div \
style="font-size:16px"><div>def warmup</div><div> @headers = {}</div><div> \
@warmup_count = $PROPS['PRISME.warmup_apache']<wbr>.to_i</div><div> \
request.headers.each do |elem|</div><div> @headers[elem.first.to_s] = \
elem.last.to_s</div><div> end</div><div> response.headers.each do \
|elem|</div><div> @headers[elem.first.to_s] = \
elem.last.to_s</div><div>end</div><div> respond_to do |format|</div><div> \
format.html # list_headers.html.erb</div><div> format.json { render :json \
=> params['counter'] }</div><div> end</div><div> \
end</div><div>#######################</div><div><br></div><div><br></div><div>Never \
sees those headers! \
Help!</div><div><br></div><div>Thanks,</div><div><br></div><div>Cris</div><div><br></div></div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 13, 2017 at 12:52 PM, \
Cris Shupp <span dir="ltr"><<a href="mailto:cshupp@gmail.com" \
target="_blank">cshupp@gmail.com</a>></span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello all...<div><br></div><div>I \
have a simple mod_perl program that does some custom role based authentication before \
granting access to certain resources. That part does work, but for a new feature I \
need to be able to embed roles into my headers. Try as may, try as I might, those \
roles never show up...</div><div><br></div><div><br></div><div>consider a portion of \
my mod_perl program:</div><div><br></div><div>sub handler \
{<br></div><div>...</div><div><div>if($user) {</div><div> my $val = \
rest_call($user,$context, $r->log);</div><div> my $roles = \
$cache_hash{'roles'}->{$user};</div><div> my $role_string = \
join(',', @$roles);</div><div> \
$r->headers_out->set('prisme-r<wbr>oles'=> $role_string \
);</div><div> #$r->headers_out->add('prisme.<wbr>roles'=> \
$role_string );</div><div> \
$r->err_headers_out->add('pris<wbr>me-roles2', \
$role_string);</div><div> #$|++;</div><div> $r->rflush();# \
$r->rflush can't be called before the response phase if using PerlFixupHandler \
Prisme::ValidateHeader</div><div> $r->log->info("Request end on \
pid $$: The user for this request is $user, the roles are $role_string, returning \
$val");</div><div> return $val; #OK or FORBIDDEN</div><div> \
}</div></div><div><br></div><div>With either config in \
http.conf:</div><div><br></div><div><div><Location /rails_prisme/></div><div> \
SetHandler perl-script</div><div> PerlResponseHandler \
Prisme::ValidateHeader</div><div> #PerlFixupHandler \
Prisme::ValidateHeader</div><div></Location></div></div><div><br></div><div>My \
Ruby on Rails controller:</div><div><br></div><div><br></div><div><br></div></div> \
</blockquote></div><br></div> <br><br>---------- Forwarded message \
----------<br>From: "André Warnier (tomcat)" <<a \
href="mailto:aw@ice-sa.com" target="_blank">aw@ice-sa.com</a>><br>To: <a \
href="mailto:modperl@perl.apache.org" \
target="_blank">modperl@perl.apache.org</a><br>Cc: <br>Bcc: <br>Date: Wed, 14 Jun \
2017 11:32:58 +0200<br>Subject: Re: lost headers<br>Hi.<br> To avoid another round \
of questions/answers, it would be better to provide some versions of what you are \
using, right away.<br> One quick way of doing this, is to insert here the line which \
appears in your Apache webserver main error logfile at startup.<br> It shows the \
Apache httpd version, the version of perl, and the version of mod_perl.<br> <br>
Secondly, in your explanation below, it is not very clear when/if your "Ruby on \
Rails controller" is even called.<br> <br>
You are seting this in the Apache httpd configuration :<br>
<br>
<Location /rails_prisme/><br>
SetHandler perl-script<br>
PerlResponseHandler Prisme::ValidateHeader<br>
</Location><br>
<br>
That means that mod_perl (and the Prisme::ValidateHeader mod_perl module) are \
effectively, for Apache, the code which generates the HTTP response to this \
request.<br> No further "response generator" will be called for this \
request (such as any "Ruby on Rails" module which might then have seen \
these response headers).<br> <br>
(In other words : I think that your headers /are/ being set; but that there is \
nothing that runs afterward to show you that they are set.)<br> <br>
Configuring your module as a PerlFixupHandler (*and* dropping the "SetHandler \
perl-script") would avoid this. But in such a handler, you can only return \
"OK" or "DECLINED" (and not "FORBIDDEN"), see : <a \
href="http://perl.apache.org/docs/2.0/user/handlers/intro.html#Stacked_Handlers" \
rel="noreferrer" target="_blank">http://perl.apache.org/docs/2.<wbr>0/user/handlers/intro.html#Sta<wbr>cked_Handlers</a><br>
<br>
Personally however, considering that this seems to be a part of an AAA phase, I would \
make adding this header as either a part of the already-existing Perl Authentication \
module, or configure your perl module as a PerlAuthenHandler.<br> (In that case also, \
you /can/ return FORBIDDEN).<br> <br>
<br>
<br>
On 13.06.2017 18:54, Cris Shupp wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex"> Hello all...<br>
<br>
I have a simple mod_perl program that does some custom role based authentication \
before<br> granting access to certain resources. That part does work, but for a new \
feature I need<br> to be able to embed roles into my headers. Try as may, try as I \
might, those roles never<br> show up...<br>
<br>
<br>
consider a portion of my mod_perl program:<br>
<br>
#####################<br>
sub handler {<br>
...<br>
if($user) {<br>
my $val = rest_call($user,$context, $r->log);<br>
my $roles = $cache_hash{'roles'}->{$user};<br>
my $role_string = join(',', @$roles);<br>
$r->headers_out->set('prisme-<wbr>roles'=> \
$role_string );<br>
#$r->headers_out->add('prisme<wbr>.roles'=> \
$role_string );<br>
$r->err_headers_out->add('pri<wbr>sme-roles2', \
$role_string);<br> #$|++;<br>
$r->rflush();# $r->rflush can't be called before the response \
phase if using<br> PerlFixupHandler Prisme::ValidateHeader<br>
$r->log->info("Request end on pid $$: The user for this \
request is $user, the<br> roles are $role_string, returning $val");<br>
return $val; #OK or FORBIDDEN<br>
}<br>
##############################<wbr>#####<br>
<br>
With either config in http.conf:<br>
##############################<br>
<Location /rails_prisme/><br>
SetHandler perl-script<br>
PerlResponseHandler Prisme::ValidateHeader<br>
#PerlFixupHandler Prisme::ValidateHeader<br>
</Location><br>
####################<br>
<br>
<br>
My Ruby on Rails controller:<br>
#######################<br>
def warmup<br>
@headers = {}<br>
@warmup_count = $PROPS['PRISME.warmup_apache']<wbr>.to_i<br>
request.headers.each do |elem|<br>
@headers[elem.first.to_s] = elem.last.to_s<br>
end<br>
response.headers.each do |elem|<br>
@headers[elem.first.to_s] = elem.last.to_s<br>
end<br>
respond_to do |format|<br>
format.html # list_headers.html.erb<br>
format.json { render :json => params['counter'] }<br>
end<br>
end<br>
#######################<br>
<br>
<br>
Never sees those headers! Help!<br>
<br>
Thanks,<br>
<br>
Cris<br>
<br>
<br>
On Tue, Jun 13, 2017 at 12:52 PM, Cris Shupp <<a href="mailto:cshupp@gmail.com" \
target="_blank">cshupp@gmail.com</a> <mailto:<a href="mailto:cshupp@gmail.com" \
target="_blank">cshupp@gmail.com</a>>><br> wrote:<br>
<br>
Hello all...<br>
<br>
I have a simple mod_perl program that does some custom role based \
authentication<br>
before granting access to certain resources. That part does work, but for a \
new<br>
feature I need to be able to embed roles into my headers. Try as may, try as \
I might,<br> those roles never show up...<br>
<br>
<br>
consider a portion of my mod_perl program:<br>
<br>
sub handler {<br>
...<br>
if($user) {<br>
my $val = rest_call($user,$context, $r->log);<br>
my $roles = $cache_hash{'roles'}->{$user};<br>
my $role_string = join(',', @$roles);<br>
$r->headers_out->set('prisme-<wbr>roles'=> \
$role_string );<br>
#$r->headers_out->add('prisme<wbr>.roles'=> \
$role_string );<br>
$r->err_headers_out->add('pri<wbr>sme-roles2', \
$role_string);<br> #$|++;<br>
$r->rflush();# $r->rflush can't be called before the \
response phase if using<br> PerlFixupHandler Prisme::ValidateHeader<br>
$r->log->info("Request end on pid $$: The user for \
this request is $user, the<br> roles are $role_string, returning $val");<br>
return $val; #OK or FORBIDDEN<br>
}<br>
<br>
With either config in http.conf:<br>
<br>
<Location /rails_prisme/><br>
SetHandler perl-script<br>
PerlResponseHandler Prisme::ValidateHeader<br>
#PerlFixupHandler Prisme::ValidateHeader<br>
</Location><br>
<br>
My Ruby on Rails controller:<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
<br>
<br></blockquote></div><br></div></div>
</div><br></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic