[Catalyst] Catalyst authentication w/ CAS

Baron Fujimoto catalystframework.org at monkeybutt.com
Wed Sep 9 03:40:23 GMT 2015


Hello,

ObWarning: Total Catalyst noob here. I'm fairly familiar with Perl, but
am just getting started with Catalyst. I'm more used to back-end, or
command line type perl applications and utilities, but now I'm trying to
develop a fairly simple web application and my survey of options turned
up Catalyst. So far I've run through the tutorials up through
Authorization at <https://metacpan.org/pod/Catalyst::Manual::Tutorial>,
though I won't pretend I've grokked most of it yet.

One of the reasons I've decided to try Catalyst, is that I would like to
authenticate the app's users with JASIG's CAS, and I noted that there's a
Catalyst::Authentication::Credential::CAS module.

Is there a more fleshed out example of using this than in the metacpan
documentation?

I'm starting with trying to add CAS authentication to what is basically
the Tutorial's Hello World app at the end of
<https://metacpan.org/pod/Catalyst::Manual::Tutorial::02_CatalystBasics>

Per the Authentication tutorial and the documentation for
Catalyst::Authentication::Credential::CAS, I have the following in
lib/MyApp.pm:


use Catalyst qw/
     -Debug
     ConfigLoader
     Static::Simple

     StackTrace

     Authentication

     Session
     Session::Store::File
     Session::State::Cookie
/;

...
# modified to match the style in the AuthN tutorial
__PACKAGE__->config(
     'Plugin::Authentication' => {
         default_realm => 'default',
         default => {
             credential => {
                 class          => 'CAS',
                 uri            => 'https://cas.example.com/cas',
                 #username_field => 'username', # optional
                 #version        => '2.0',      # optional
             },
         },
         #store => {
         #  ...
         #},
     },
);

And in lib/MyApp/Controller/Root.pm:

When the development server reloads, I get the following output:

[debug] Debug messages enabled
[debug] Statistics enabled
[debug] Loaded Config ".../MyApp/myapp.conf"
[debug] Setting up auth realm default
[debug] No Store specified for realm "default", using the Null store.
Global symbol "$c" requires explicit package name at
+.../MyApp/script/../lib/MyApp/Controller/Root.pm line 74.
Global symbol "$c" requires explicit package name at
+.../MyApp/script/../lib/MyApp/Controller/Root.pm line 74.
Global symbol "$c" requires explicit package name at
+.../MyApp/script/../lib/MyApp/Controller/Root.pm line 75.
Global symbol "$c" requires explicit package name at
+.../MyApp/script/../lib/MyApp/Controller/Root.pm line 76.
BEGIN not safe after errors--compilation aborted at
+.../MyApp/script/../lib/MyApp/Controller/Root.pm line 79.

I had commented out 'store' in the Plugin::Authentication config hash
since I wasn't sure what to use there yet, and at least it seems nominally
ok with a "Null" store for now.

I'm not sure why the global symbol errors though, since since $c is used
in the other methods.

I apologize for what are probably very basic questions, but I would
appreciate any guidance here.

Aloha,
-baron



More information about the Catalyst mailing list