.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "CatalystX::SimpleLogin::Manual 3pm" .TH CatalystX::SimpleLogin::Manual 3pm "2022-08-28" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" CatalystX::SimpleLogin::Manual \- How to use and customise CatalystX::SimpleLogin. .SS "Tutorial" .IX Subsection "Tutorial" We're using a sample application here, to make the instructions a little easier. This assumes that you have Catalyst, Catalyst::Devel, Template Toolkit, and the Catalyst authentication and session plugins installed. .PP .Vb 3 \& catalyst.pl MyApp \& cd MyApp \& script/myapp_create.pl view HTML TT .Ve .PP Edit lib/MyApp.pm and add CatalystX::SimpleLogin, Authenticate, and the Session plugins to the use Catalyst plugin list: .PP .Vb 8 \& use Catalyst qw/\-Debug \& ConfigLoader \& +CatalystX::SimpleLogin \& Authentication \& Session \& Session::Store::File \& Session::State::Cookie \& Static::Simple/; .Ve .PP Add the following config for authentication, including two sample users: .PP .Vb 10 \& _\|_PACKAGE_\|_\->config( \& \*(AqPlugin::Authentication\*(Aq => { \& default => { \& credential => { \& class => \*(AqPassword\*(Aq, \& password_field => \*(Aqpassword\*(Aq, \& password_type => \*(Aqclear\*(Aq \& }, \& store => { \& class => \*(AqMinimal\*(Aq, \& users => { \& bob => { \& password => "bobpw", \& }, \& william => { \& password => "billpw", \& }, \& }, \& }, \& }, \& }, \& ); .Ve .PP Execute \f(CW\*(C` script/myapp_server.pl \*(C'\fR and, as part of the debug output, you should see: .PP .Vb 7 \& [debug] Loaded Chained actions: \& .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. \& | Path Spec | Private | \& +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \& | /login | /login/login | \& | /logout | /login/logout | \& \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq .Ve .PP Go to \f(CW\*(C` localhost:3000 \*(C'\fR and you should see the Catalyst welcome screen. Go to \&\f(CW\*(C` localhost:3000/login \*(C'\fR and you should get a login screen containing username and password text fields, a 'Remember' checkbox, and a 'Login' button. Enter 'bob' and \&'bobpw'. You should be logged in and taken to the welcome screen. If you execute \&\f(CW\*(C` localhost:3000/logout \*(C'\fR you will be logged out, and should see this in the debug output (the welcome screen will stay the same). .PP Now go to \f(CW\*(C` lib/MyApp/Controller/Root.pm \*(C'\fR and remove the lines saying: .PP .Vb 3 \& use strict; \& use warnings; \& use parent \*(AqCatalyst::Controller\*(Aq; .Ve .PP and add the following lines: .PP .Vb 3 \& use Moose; \& use namespace::autoclean; \& BEGIN { extends \*(AqCatalyst::Controller\*(Aq } .Ve .PP Now add a new action to \f(CW\*(C` lib/MyApp/Controller/Root.pm \*(C'\fR and include \&\f(CW\*(C` Does(\*(AqNeedsLogin\*(Aq) \*(C'\fR to use the Catalyst ActionRole that is part of SimpleLogin: .PP .Vb 4 \& sub hello_user : Local Does(\*(AqNeedsLogin\*(Aq) { \& my ( $self, $c ) = @_; \& $c\->res\->body(\*(Aq