« blib/lib/Jifty/Plugin/Authentication/CAS/Action/CASLogout.pm
↑ Summary
blib/lib/Jifty/Plugin/Authentication/CAS/Mixin/Model/User.pm »
| 1 | use strict; | ||
| 2 | use warnings; | ||
| 3 | |||
| 4 | package Jifty::Plugin::Authentication::CAS::Dispatcher; | ||
| 5 | use Jifty::Dispatcher -base; | ||
| 6 | |||
| 7 | # whitelist safe actions to avoid cross-site scripting | ||
| 8 | before '*' => run { Jifty->api->allow('CASLogout') }; | ||
| 9 | |||
| 10 | # Put any plugin-specific dispatcher rules here. | ||
| 11 | |||
| 12 | before '/caslogin' => run { | ||
| 13 | if (get('ticket')) { | ||
| 14 | # verify ticket | ||
| 15 | set 'action' => | ||
| 16 | Jifty->web->new_action( | ||
| 17 | class => 'CASLogin', | ||
| 18 | moniker => 'casloginbox', | ||
| 19 | arguments => { ticket => get('ticket') }, | ||
| 20 | ); | ||
| 21 | |||
| 22 | |||
| 23 | }; | ||
| 24 | |||
| 25 | set 'next' => Jifty->web->request->continuation | ||
| 26 | || Jifty::Continuation->new( | ||
| 27 | request => Jifty::Request->new( path => "/" ) ); | ||
| 28 | |||
| 29 | }; | ||
| 30 | |||
| 31 | |||
| 32 | on '/caslogin' => run { | ||
| 33 | |||
| 34 | Jifty->web->new_action( | ||
| 35 | moniker => 'casloginbox', | ||
| 36 | class => 'CASLogin', | ||
| 37 | arguments => { ticket => get('ticket') } | ||
| 38 | )->run; | ||
| 39 | |||
| 40 | if(Jifty->web->request->continuation) { | ||
| 41 | Jifty->web->request->continuation->call; | ||
| 42 | } else { | ||
| 43 | redirect '/'; | ||
| 44 | } | ||
| 45 | }; | ||
| 46 | |||
| 47 | # Log out | ||
| 48 | before '/caslogout' => run { | ||
| 49 | Jifty->web->request->add_action( | ||
| 50 | class => 'CASLogout', | ||
| 51 | moniker => 'caslogout', | ||
| 52 | ); | ||
| 53 | }; | ||
| 54 | |||
| 55 | on '/caslogout' => run { | ||
| 56 | redirect '/'; | ||
| 57 | }; | ||
| 58 | |||
| 59 | 1; |