[Catalyst] Re: Announcement - New Authen/Authz plugins

Sascha Kiefer sk at intertivity.com
Wed Nov 9 13:56:28 CET 2005


Hi,

i had the idea auf hidding the authentication steps.
i would like stuff like

Authentication::Credential::BASIC,
Authentication::Credential::NTLM,
...

just plug it in and it works. (like always :) )
Is it planed? Would like to help/or do it myself, since i need it - specially NTLM.

Have fun,
--esskar



Uwe Voelker schrieb:

>Here is an example for working "http auth" code:
>
>
># Catalyst plugin: basic authentication (for all pages)
>
>use MIME::Base64;
>
>
>MyApp->config(
>              name    => 'MyApp',
>              #                     USER    PASS     KUNDE (0 = alle)
>              auth    => {user => [['uwe',  'uwe',    0],
>                                   ['uwe2', 'secret', 1],
>                                  ],
>                         },
>             );
>
>sub auto : Private {
>    my ($self, $c) = @_;
>
>    # Authorization-Header hinzufuegen
>    $c->res->header('WWW-Authenticate' => 'Basic realm="My realm"');
>
>    # wurden bereits Username und Passwort uebergeben?
>    my $auth = $c->req->header('Authorization') || '';
>    if ($auth =~ /Basic (.+)/) {
>        my ($user, $pass) = split(/:/, decode_base64($1));
>
>        foreach my $row (@{$c->config->{auth}->{user}}) {
>            if ($user eq $row->[0] and $pass eq $row->[1]) {
>                $c->stash->{auth_kunde} = $row->[2];
>                return 1;
>            }
>        }
>    }
>
>    $c->res->status(401);
>    $c->res->body('Authentication required');
>
>    return 0;
>}
>
>
>It only stores the customer number in 'auth_kunde'. It need's to be
>polished up (configure realm and so on). But it was working very well.
>
>
>Bye,
>Uwe
>
>_______________________________________________
>Catalyst mailing list
>Catalyst at lists.rawmode.org
>http://lists.rawmode.org/mailman/listinfo/catalyst
>
>
>  
>




More information about the Catalyst mailing list