[Dancer-users] Dancer-users Digest, Vol 10, Issue 18

Gurunandan Bhat gbhat at pobox.com
Tue Dec 14 17:49:43 CET 2010


On Tue, Dec 14, 2010 at 9:20 PM, Al Newkirk & Associates <we at ana.im> wrote:

> Okay now that im on an actual computer we can chat ... RBAC is
> kinda-complex idea I suppose. Once grasp it you'll understand that what
> you're trying to do already exists. If you want to package your custom auth
> module with your app, simply add
> lib/Dancer/Plugin/Auth/RBAC/Credentials/MyAuth.pm to your app, now it can be
> shipped as you like.


Now, I get it!


> Someone gave you a bit of misinformation regarding the config file ... this
> is what it should look like:
>
> plugins:
>    Auth::RBAC:
>        credentials:
>            class: MyAuth
>                options: (everything under this gets passed-in)
>
> Also, this variable $Dancer::Plugin::Auth::RBAC::settings holds all plugin
> variables (hashref)
>
>
Thanks for the correction. Am writing one now.











> On Tue, Dec 14, 2010 at 10:03 AM, <dancer-users-request at perldancer.org>wrote:
>
>> Send Dancer-users mailing list submissions to
>>        dancer-users at perldancer.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>>        http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>> or, via email, send a message with subject or body 'help' to
>>        dancer-users-request at perldancer.org
>>
>> You can reach the person managing the list at
>>        dancer-users-owner at perldancer.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Dancer-users digest..."
>>
>>
>> Today's Topics:
>>
>>   1. Re: Dancer-users Digest, Vol 10, Issue 14 (Gurunandan Bhat)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 14 Dec 2010 20:33:22 +0530
>> From: Gurunandan Bhat <gbhat at pobox.com>
>> Subject: Re: [Dancer-users] Dancer-users Digest, Vol 10, Issue 14
>> To: awnstudio at gmail.com
>> Cc: dancer-users at perldancer.org
>> Message-ID:
>>        <AANLkTimPNrhqpNZS9RW20NxX8YDuwAFKW3=_y4WLfe2N at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> On Tue, Dec 14, 2010 at 1:20 PM, <awnstudio at gmail.com> wrote:
>>
>> > Just my 2 cents, ... From my blackberry. RBAC::Credentials::MyAuth is
>> where
>> > you should create you custom auth class.
>>
>>
>> I would normally have preferred to use the App Namespace rather than the
>> RBACC namespace. One advantage that I see in doing this is that it allows
>> me
>> to distribute and control my application from a single point rather than
>> have the deployer install modules in different folders.
>>
>> What I loose is that plugin_setting() will no longer return config under
>>
>> plugins:
>>    Auth::RBAC:
>>        credentials:
>>            class: MyAuth
>>                mykey: myvalue
>>
>> and that I will have to create a custom entry outside the plugins: yaml
>> tree. I can live with that. In fact I just got introduced to Dancer 4
>> waking
>> hours ago and I have already ported 2 apps. With that kind of power, I
>> guess
>> I can live with anything :)
>>
>>
>> > Yes you can subclass it but the boilerplate is very minimal so just copy
>> > and paste and alter.
>> >
>> >
>> True.
>>
>>
>> > Also in the config.yml, everything under the plugin name is passed as
>> the
>> > options hashref, .e.g. Config, MySQL, MyApp, etc
>> >
>>
>> ...but only if you are under the Dancer::Plugin namespace - subclassing
>> Dance::Plugin is, I understand not enough.
>>
>> Thanks for your comments - it did help me understand this a little better.
>>
>>
>>
>>
>> Sent from my Verizon Wireless BlackBerry
>> >
>> > -----Original Message-----
>> > From: dancer-users-request at perldancer.org
>> > Sender: dancer-users-bounces at perldancer.org
>> > Date: Tue, 14 Dec 2010 09:56:42
>> > To: <dancer-users at perldancer.org>
>> > Reply-To: dancer-users at perldancer.org
>> > Subject: Dancer-users Digest, Vol 10, Issue 14
>> >
>> > Send Dancer-users mailing list submissions to
>> >        dancer-users at perldancer.org
>> >
>> > To subscribe or unsubscribe via the World Wide Web, visit
>> >        http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>> > or, via email, send a message with subject or body 'help' to
>> >        dancer-users-request at perldancer.org
>> >
>> > You can reach the person managing the list at
>> >        dancer-users-owner at perldancer.org
>> >
>> > When replying, please edit your Subject line so it is more specific
>> > than "Re: Contents of Dancer-users digest..."
>> >
>> >
>> > Today's Topics:
>> >
>> >   1. Can I subclass DP::Authorize::Credentials from a  different
>> >      namespace (Gurunandan Bhat)
>> >   2. Use of uninitialized value $values[0] in... Route.pm      line 80
>> >      (Puneet Kishor)
>> >   3. Secure http (https) with Dancer (Gurunandan Bhat)
>> >   4. Re: Secure http (https) with Dancer (Roman Galeev)
>> >   5. Re: Secure http (https) with Dancer (Gurunandan Bhat)
>> >   6. Re: Can I subclass DP::Authorize::Credentials from a
>> >      different namespace (sawyer x)
>> >   7. Re: Use of uninitialized value $values[0] in... Route.pm line
>> >      80 (sawyer x)
>> >
>> >
>> > ----------------------------------------------------------------------
>> >
>> > Message: 1
>> > Date: Tue, 14 Dec 2010 00:40:46 +0530
>> > From: Gurunandan Bhat <gbhat at pobox.com>
>> > Subject: [Dancer-users] Can I subclass DP::Authorize::Credentials from
>> >        a       different namespace
>> > To: Dancers <dancer-users at perldancer.org>
>> > Message-ID:
>> >        <AANLkTi=UP2aDRsH2tiWWWHMnoEK4pJsJtyJumPW=-Fiv at mail.gmail.com>
>> > Content-Type: text/plain; charset=ISO-8859-1
>> >
>> > Hi,
>> >
>> > I want to subclass Dancer::Plugin::Authorize::Credentials but not in the
>> > DPAC namespace, but in my App namespace, essentially something that
>> > would go like this:
>> >
>> > package App:Authenticate;
>> > use base qw/Dancer::Plugin::Authorize::Credentials/;
>> >
>> > sub authorize {
>> >    my ($app, $opts, $username, $passwd) = @_;
>> >    .....
>> > }
>> >
>> > 1;
>> >
>> > I have two questions:
>> >
>> > 1. Can I do this?
>> > 2. If yes, how do I set option parameters in config.yml so that they are
>> > passed as a hashref in $opts.
>> >
>> > Thank you.
>> >
>> >
>> > -----------------------------------------------------------------
>> > dancer does for web frameworks what sqlite did to databases
>> >
>> >
>> > ------------------------------
>> >
>> > Message: 2
>> > Date: Mon, 13 Dec 2010 16:30:05 -0600
>> > From: Puneet Kishor <punk.kish at gmail.com>
>> > Subject: [Dancer-users] Use of uninitialized value $values[0] in...
>> >        Route.pm        line 80
>> > To: dancer-users <dancer-users at perldancer.org>
>> > Message-ID: <4D069E6D.3000307 at gmail.com>
>> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>> >
>> > How do I debug something like this?
>> >
>> > [Mon Dec 13 16:26:07 2010] [error] [client 127.0.0.1] Use of
>> > uninitialized value $values[0] in join or string at
>> > /usr/local/lib/perl5/site_perl/5.12.1/Dancer/Route.pm line 80.
>> >
>> > Seems to happen when I visit the root of my web site, for example,
>> > http://server.com/ without anything after .com/....
>> >
>> > --
>> > Puneet Kishor
>> >
>> >
>> >
>> >
>> > ------------------------------
>> >
>> > Message: 3
>> > Date: Tue, 14 Dec 2010 09:11:38 +0530
>> > From: Gurunandan Bhat <gbhat at pobox.com>
>> > Subject: [Dancer-users] Secure http (https) with Dancer
>> > To: Dancers <dancer-users at perldancer.org>
>> > Message-ID:
>> >        <AANLkTi=UPa4=FDPGTwaDKaRgiat=6jUETVTD-8KaUKFs at mail.gmail.com>
>> > Content-Type: text/plain; charset=ISO-8859-1
>> >
>> > Hi,
>> >
>> > How can I write a secure http web application with Dancer.
>> > I would like my application to be available on https://myapp
>> >
>> >
>> > Thank you
>> >
>> >
>> > ------------------------------
>> >
>> > Message: 4
>> > Date: Tue, 14 Dec 2010 10:07:42 +0500
>> > From: Roman Galeev <noc at nelcom-voip.com>
>> > Subject: Re: [Dancer-users] Secure http (https) with Dancer
>> > Cc: Dancers <dancer-users at perldancer.org>
>> > Message-ID: <20101214100742.49036a1e at lenobook.jh>
>> > Content-Type: text/plain; charset=UTF-8
>> >
>> > ?? Tue, 14 Dec 2010 09:11:38 +0530
>> > Gurunandan Bhat <gbhat at pobox.com> ????????:
>> >
>> > > Hi,
>> > >
>> > > How can I write a secure http web application with Dancer.
>> > > I would like my application to be available on https://myapp
>> >
>> > Just put nginx in front of dancer.
>> >
>> >
>> > ------------------------------
>> >
>> > Message: 5
>> > Date: Tue, 14 Dec 2010 11:27:59 +0530
>> > From: Gurunandan Bhat <gbhat at pobox.com>
>> > Subject: Re: [Dancer-users] Secure http (https) with Dancer
>> > To: Roman Galeev <noc at nelcom-voip.com>
>> > Cc: Dancers <dancer-users at perldancer.org>
>> > Message-ID:
>> >        <AANLkTimyvru92aj=xwUm1F6cEShOHhiGu-6WbKYavTQ2 at mail.gmail.com>
>> > Content-Type: text/plain; charset=UTF-8
>> >
>> > Thank you.
>> > I have set up a reverse apache proxy and I was wondering if there was
>> > a better way
>> >
>> > Thanks once again
>> >
>> > On Tue, Dec 14, 2010 at 10:37 AM, Roman Galeev <noc at nelcom-voip.com>
>> > wrote:
>> > > ?? Tue, 14 Dec 2010 09:11:38 +0530
>> > > Gurunandan Bhat <gbhat at pobox.com> ????????:
>> > >
>> > >> Hi,
>> > >>
>> > >> How can I write a secure http web application with Dancer.
>> > >> I would like my application to be available on https://myapp
>> > >
>> > > Just put nginx in front of dancer.
>> > > _______________________________________________
>> > > Dancer-users mailing list
>> > > Dancer-users at perldancer.org
>> > > http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>> > >
>> >
>> >
>> > ------------------------------
>> >
>> > Message: 6
>> > Date: Tue, 14 Dec 2010 10:51:10 +0200
>> > From: sawyer x <xsawyerx at gmail.com>
>> > Subject: Re: [Dancer-users] Can I subclass DP::Authorize::Credentials
>> >        from a different namespace
>> > To: Gurunandan Bhat <gbhat at pobox.com>
>> > Cc: Dancers <dancer-users at perldancer.org>
>> > Message-ID:
>> >        <AANLkTimGAbcA_7HCDPMvOMhO5BL7YU9GtoEfXbomF16r at mail.gmail.com>
>> > Content-Type: text/plain; charset="iso-8859-1"
>> >
>> > Hi!
>> >
>> > First of all, Dance::Plugin::Authorize has been renamed as
>> > Dancer::Plugin::Auth::RBAC<
>> > http://search.cpan.org/perldoc?Dancer::Plugin::Auth::RBAC>
>> > .
>> >
>> > This was a crucial change in order to allow a more organic expansion of
>> the
>> > Plugin namespace.
>> >
>> > On Mon, Dec 13, 2010 at 9:10 PM, Gurunandan Bhat <gbhat at pobox.com>
>> wrote:
>> >
>> > >
>> > > 1. Can I do this?
>> > >
>> >
>> > Of course.
>> >
>> >
>> > > 2. If yes, how do I set option parameters in config.yml so that they
>> are
>> > > passed as a hashref in $opts.
>> > >
>> >
>> > In order to get Dancer to send your subclass the configuration for the
>> > plugin, it has to sit on the Plugin namespace. That is, it should be
>> called
>> > Dancer::Plugin::My::App::Authorize or something like that. Then just set
>> > the
>> > correct plugin name in the config.yml file.
>> >
>> > For example:
>> >
>> >    plugins:
>> >      My::App::Authorize:
>> >        credentials:
>> >          class: Config
>> >          options:
>> >            accounts:
>> >              user01:
>> >                password: foobar
>> >
>> >                roles:
>> >                  - guest
>> >                  - user
>> >              user02:
>> >                password: barbaz
>> >                roles:
>> >                  - admin
>> >
>> >
>> > If you still wish to separate the namespace, you have two options:
>> > 1. Simply read the settings yourself from the config file
>> > (setting('MyApp')->{'authorize') or something like that).
>> > 2. You can re-register your subclass with Dancer, making sure Dancer
>> sends
>> > it its settings automatically. Check the RBAC.pm source for this.
>> >
>> > When subclassing RBAC, notice it has lexical file-scoped variables
>> > (specifically $settings). These variables won't be overridden by simply
>> > subclassing or fiddling with the symbol table, since they're sitting in
>> the
>> > lexical pad of the file. If you find need for RBAC to refactor and
>> abstract
>> > away that part, feel free to make any suggestions or (better yet)
>> patches
>> > to
>> > do that.
>> >
>> > Franck is working on refactoring RBAC and he could take that into
>> account,
>> > if you approach him with it.
>> >
>> > Good luck, happy hacking! :)
>> >
>> > Sawyer.
>> > -------------- next part --------------
>> > An HTML attachment was scrubbed...
>> > URL: <
>> >
>> http://www.backup-manager.org/pipermail/dancer-users/attachments/20101214/13c3a949/attachment-0001.htm
>> > >
>> >
>> > ------------------------------
>> >
>> > Message: 7
>> > Date: Tue, 14 Dec 2010 10:56:17 +0200
>> > From: sawyer x <xsawyerx at gmail.com>
>> > Subject: Re: [Dancer-users] Use of uninitialized value $values[0]
>> >        in... Route.pm line 80
>> > To: Puneet Kishor <punk.kish at gmail.com>
>> > Cc: dancer-users <dancer-users at perldancer.org>
>> > Message-ID:
>> >        <AANLkTinVVV-nvHxmE-vDFyRJsd5mYhEa9usKKbtEGk+W at mail.gmail.com<AANLkTinVVV-nvHxmE-vDFyRJsd5mYhEa9usKKbtEGk%2BW at mail.gmail.com>
>> <AANLkTinVVV-nvHxmE-vDFyRJsd5mYhEa9usKKbtEGk%2BW at mail.gmail.com<AANLkTinVVV-nvHxmE-vDFyRJsd5mYhEa9usKKbtEGk%252BW at mail.gmail.com>
>> >
>> > >
>> > Content-Type: text/plain; charset="iso-8859-1"
>> >
>> > On Tue, Dec 14, 2010 at 12:30 AM, Puneet Kishor <punk.kish at gmail.com>
>> > wrote:
>> >
>> > > How do I debug something like this?
>> > >
>> >
>> > You should activate the "console" logger and set the debugging flag on.
>> >
>> > You'll notice this line to help you understand what's going on:
>> >    Dancer::Logger::core("trying to match `$path' "
>> >          . "against /"
>> >          . $self->{_compiled_regexp}
>> >          . "/");
>> >
>> > It appears @values is being created by trying to match $path against the
>> > compiled regex. That print will basically tell you what's wrong.
>> >
>> > I would personally just download the latest stable, and run it locally
>> with
>> > "perl -IDancer-1.2003/lib bin/app.pl" (YMMV) so I could hack at the
>> file,
>> > if
>> > I need to.
>> >
>> > Sawyer.
>> > -------------- next part --------------
>> > An HTML attachment was scrubbed...
>> > URL: <
>> >
>> http://www.backup-manager.org/pipermail/dancer-users/attachments/20101214/075a7cf7/attachment.htm
>> > >
>> >
>> > ------------------------------
>> >
>> > _______________________________________________
>> > Dancer-users mailing list
>> > Dancer-users at perldancer.org
>> > http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>> >
>> >
>> > End of Dancer-users Digest, Vol 10, Issue 14
>> > ********************************************
>> > _______________________________________________
>> > Dancer-users mailing list
>> > Dancer-users at perldancer.org
>> > http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>> >
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <
>> http://www.backup-manager.org/pipermail/dancer-users/attachments/20101214/2589480f/attachment.htm
>> >
>>
>> ------------------------------
>>
>> _______________________________________________
>> Dancer-users mailing list
>> Dancer-users at perldancer.org
>> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>>
>>
>> End of Dancer-users Digest, Vol 10, Issue 18
>> ********************************************
>>
>
>
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20101214/6b9a13f7/attachment-0001.htm>


More information about the Dancer-users mailing list