Skip Menu |

This queue is for tickets about the Catalyst-Plugin-Authentication CPAN distribution.

Report information
The Basics
Id: 46352
Status: resolved
Priority: 0/
Queue: Catalyst-Plugin-Authentication

People
Owner: bobtfish [...] bobtfish.net
Requestors: kmx [...] volny.cz
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Proposal Catalyst::Authentication::Credential::Remote
Date: Mon, 25 May 2009 16:16:19 +0200
To: bug-Catalyst-Plugin-Authentication [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
package Catalyst::Authentication::Credential::Remote; use strict; use warnings; use base 'Class::Accessor::Fast'; BEGIN { __PACKAGE__->mk_accessors(qw/_config realm/); } sub new { my ( $class, $config, $app, $realm ) = @_; my $self = { _config => $config }; bless $self, $class; $self->realm($realm); return $self; } sub authenticate { my ( $self, $c, $realm, $authinfo ) = @_; my $allow_re = $self->_config->{'allow_regexp'}; my $deny_re = $self->_config->{'deny_regexp'}; my $remuser = $c->req->remote_user; # user authenticated by WWW server my $authuser = $authinfo->{username}; return unless defined($remuser); return if (defined($authuser) && ($authuser ne $remuser) ); return if (defined($deny_re) && ($remuser =~ /$deny_re/) ); return if (defined($allow_re) && ($remuser !~ /$allow_re/)); $authinfo->{id} = $authinfo->{username} = $remuser; my $user_obj = $realm->find_user( $authinfo, $c ); return ref($user_obj) ? $user_obj : undef; } 1;
Hi, I have prepared a draft of credential module that works like "web server does auth for me, I trust it and wanna use it in my CatApp" It uses $c->remote_user variable that is currently available just in Cat trunk revision (probably will be part of 5.80005). I you find it useful I am ready to finalize it and write a doc and would appreciate if you could include it into Catalyst-Plugin-Authentication (yes, I am lazy to start a new separate module). Of course any comments are welcome (to the overall idea as well as the proposed implementation). -- kmx
Subject: Re: [rt.cpan.org #46352] Proposal Catalyst::Authentication::Credential::Remote
Date: Mon, 25 May 2009 16:27:01 +0100
To: bug-Catalyst-Plugin-Authentication [...] rt.cpan.org
From: Tomas Doran <bobtfish [...] bobtfish.net>
On 25 May 2009, at 15:16, kmx via RT wrote: Show quoted text
> BEGIN { > __PACKAGE__->mk_accessors(qw/_config realm/); > }
<snip> Note that everything is stored in _config in most of the Catalyst::Authentication::* modules for historical reasons. I recommend making 'proper' accessors for things like 'allow_regexp', 'deny_regexp', and getting rid of _config in the new code. Show quoted text
> > I have prepared a draft of credential module that works like "web > server > does auth for me, I trust it and wanna use it in my CatApp" > > It uses $c->remote_user variable that is currently available just > in Cat > trunk revision (probably will be part of 5.80005).
Aha, nice work - I've not needed this yet, so haven't written it, but it was on my list somewhere :) I guess the correct thing to do is to check $c->req->can ('remote_user') || $c->req->can('user'); as this should be forwards and backwards compatible.. Show quoted text
> I you find it useful I am ready to finalize it and write a doc and > would > appreciate if you could include it into Catalyst-Plugin-Authentication > (yes, I am lazy to start a new separate module).
Welcome to the @catalyst-aaa svn group, please branch Catalyst-Plugin- Authentication and commit away. Give myself and/or jayk a yell on irc when you're happy for review/ merge and release. Show quoted text
> Of course any comments are welcome (to the overall idea as well as the > proposed implementation).
None, other than the _config thing as above. Cheers t0m
Subject: Re: [rt.cpan.org #46352] Proposal Catalyst::Authentication::Credential::Remote
Date: Tue, 02 Jun 2009 14:54:02 +0200
To: bug-Catalyst-Plugin-Authentication [...] rt.cpan.org
From: kmx <kmx [...] volny.cz>
http://omni.state51.co.uk/~t0m/Catalyst-Plugin-Authentication-0.10012.tar.gz Also pushed to the CPAN. Many thanks for the work on this!!! Cheers t0m