Re: [Catalyst] Catalyst with HTTP authentication
On 25/03/13 14:08 Tomas Doran wrote: > > On 22 Mar 2013, at 13:34, Robert Rothenberg wrote: >> I'm unsure what to do here. Should I write a Plack::Middleware plugin that >> translates the X-Proxy-REMOTE_USER header to an env->{REMOTE_USER}? > > > That's exactly what's needed here :) Ok. After faffing about, I've figured it out. I've created a module package Plack::Middleware::MyRemote; use parent qw( Plack::Middleware ); use Plack::Util; sub call { my ($self, $env) = @_; $env->{REMOTE_USER} = $env->{HTTP_X_PROXY_REMOTE_USER} if ($env->{HTTP_X_PROXY_REMOTE_USER}); my $res = $self->app->($env); return $res; } 1; and modified myapp.psgi to use strict; use warnings; use MyApp; use Plack::Builder; my $app = Drain->apply_default_middlewares(Drain->psgi_app); builder { enable "Plack::Middleware::MyRemote"; $app; }; that seems to work now. In the Apache configuration, I need to add: RequestHeader unset X-Proxy-REMOTE_USER RewriteEngine On RewriteCond %{LA-U:REMOTE_USER} (.+) RewriteRule . - [E=RU:%1] RequestHeader add X-Proxy-REMOTE_USER %{RU}e along with the requirement to log in for the specific directory. I'd suggest updating the documentation for A::C::Remote accordingly. (I can do this if you point me in the direction of the git repo) This seems to work properly. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Setting an environment variable with the value of a header
On 25/03/13 14:11 Tomas Doran wrote: > > On 25 Mar 2013, at 11:51, Robert Rothenberg wrote: >> >> The issue is getting Catalyst to use the header in place of the >> environment variable. > > > Erm, the remote user Authentication::Credential::Remote comes from a > header, not the environment already. Really? It seems to use the REMOTE_USER variable when I've tried it. Looking at the source code, it seems to check the environment. If Plack is translating headers into special environment variables, then it's a matter of telling A::C::Remote a different source. What would be the name? > E.g. if you run an app as external FCGI, it has it's startup environment, > but the remote user comes per-request down FCGI (as a header)… I'm running the Plack server directly, not FCGI, and using a reverse proxy. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Setting an environment variable with the value of a header
On 25 Mar 2013, at 11:51, Robert Rothenberg wrote: > > The issue is getting Catalyst to use the header in place of the environment > variable. Erm, the remote user Authentication::Credential::Remote comes from a header, not the environment already. E.g. if you run an app as external FCGI, it has it's startup environment, but the remote user comes per-request down FCGI (as a header)… Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Catalyst with HTTP authentication
On 22 Mar 2013, at 13:34, Robert Rothenberg wrote: > I'm unsure what to do here. Should I write a Plack::Middleware plugin that > translates the X-Proxy-REMOTE_USER header to an env->{REMOTE_USER}? That's exactly what's needed here :) Cheers t0m ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] Setting an environment variable with the value of a header
On 25/03/13 03:13 Alejandro Imass wrote: > On Fri, Mar 22, 2013 at 2:32 PM, Robert Rothenberg wrote: >> I've not gotten replies to my posts regarding HTTP authentication, so I'm >> starting a separate thread. >> >> I am running a Catalyst app as a separate server with a reverse proxy. >> >> If I pass the REMOTE_USER to the Catalyst app via a header such as >> X-Proxy-REMOTE_USER, how do I set the REMOTE_USER value for in the Catalyst >> app? >> > > Is this FastCGI on Apache?? If so, the issue is not Catalyst bu that... Not, but I know how to pass the variable via headers. The issue is getting Catalyst to use the header in place of the environment variable. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] How to get IP address of the interface which the request come through
ok, perhaps I should read all emails before replying :-) Morning all ,welcome to the week! -Original Message- From: Peter Flanigan [mailto:p...@roxsoft.co.uk] Sent: 23 March 2013 14:03 To: The elegant MVC web framework Subject: Re: [Catalyst] How to get IP address of the interface which the request come through On 23/03/13 12:12, N.A. wrote: > I wan to get the IP address of the interface(network device) which > the request come through. My bad. Use $c->req->uri->host to get the hostname of the server -- Regards ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ This Email and any attachments contain confidential information and is intended solely for the individual to whom it is addressed. If this Email has been misdirected, please notify the author as soon as possible. If you are not the intended recipient you must not disclose, distribute, copy, print or rely on any of the information contained, and all copies must be deleted immediately. Whilst we take reasonable steps to try to identify any software viruses, any attachments to this e-mail may nevertheless contain viruses, which our anti-virus software has failed to identify. You should therefore carry out your own anti-virus checks before opening any documents. HomeLoan Partnership will not accept any liability for damage caused by computer viruses emanating from any attachment or other document supplied with this e-mail. HomeLoan Partnership reserves the right to monitor and archive all e-mail communications through its network. No representative or employee of HomeLoan Partnership has the authority to enter into any contract on behalf of HomeLoan Partnership by email. HomeLoan Partnership is a trading name of H L Partnership Limited, registered in England and Wales with Registration Number 5011722. Registered office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by the Financial Services Authority. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
RE: [Catalyst] How to get IP address of the interface which the request come through
I use $c->req->address -Original Message- From: N.A. [mailto:n...@u01.gate01.com] Sent: 23 March 2013 12:13 To: The elegant MVC web framework Subject: [Catalyst] How to get IP address of the interface which the request come through I wan to get the IP address of the interface(network device) which the request come through. This information can be easily obtained by "$c->engine->env->{ SERVER_ADDR }" with FCGI setting both on nginx/lighttpd web servers. However SERVER_ADDR is not defined in "Catalyst Test Server." Of course the network device is usually 'eth0', but in some situation the network device can be 'virbr0' , 'wlan0','eth1' and so on. Are there any simple and portable way to get the information. I use Catalyst of version 5.90020 on linux box. N.A. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ This Email and any attachments contain confidential information and is intended solely for the individual to whom it is addressed. If this Email has been misdirected, please notify the author as soon as possible. If you are not the intended recipient you must not disclose, distribute, copy, print or rely on any of the information contained, and all copies must be deleted immediately. Whilst we take reasonable steps to try to identify any software viruses, any attachments to this e-mail may nevertheless contain viruses, which our anti-virus software has failed to identify. You should therefore carry out your own anti-virus checks before opening any documents. HomeLoan Partnership will not accept any liability for damage caused by computer viruses emanating from any attachment or other document supplied with this e-mail. HomeLoan Partnership reserves the right to monitor and archive all e-mail communications through its network. No representative or employee of HomeLoan Partnership has the authority to enter into any contract on behalf of HomeLoan Partnership by email. HomeLoan Partnership is a trading name of H L Partnership Limited, registered in England and Wales with Registration Number 5011722. Registered office: 26-34 Old Street, London, EC1V 9QQ. H L Partnership Limited is authorised and regulated by the Financial Services Authority. ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/