Mailing List Archive

Catalyst authentication w/ CAS
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

_______________________________________________
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 authentication w/ CAS [ In reply to ]
Have you looked at the test application of the CAS module?

https://metacpan.org/source/KKANE/Catalyst-Authentication-Credential-CAS-0.05/t/lib/MyApp/lib/MyApp.pm

On 9 September 2015 at 05:40, Baron Fujimoto
<catalystframework.org@monkeybutt.com> wrote:
> 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
>
> _______________________________________________
> 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/

_______________________________________________
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 authentication w/ CAS [ In reply to ]
Hmm, I have now (sorry, didn't occur to me to look there). If I create a
new skeleton app using that, it kicks out to our CAS server as expected,
but after authenticating there I end up in the if( $c->authenticate )
else block with Access Denied. So I have two things to sort out now: 1)
find the difference between the example app below and mine that allows it
to successfully call CAS, and 2) determine why $c->authenticate is being
evaluated as false.

Aloha,
-baron

On Wed, 9 Sep 2015, David Schmidt wrote:

> Have you looked at the test application of the CAS module?
>
> https://metacpan.org/source/KKANE/Catalyst-Authentication-Credential-CAS-0.05/t/lib/MyApp/lib/MyApp.pm
>
> On 9 September 2015 at 05:40, Baron Fujimoto
> <catalystframework.org@monkeybutt.com> wrote:
>> 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
>>
>> _______________________________________________
>> 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/
>
> _______________________________________________
> 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/
>

_______________________________________________
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/