/usr/share/perl5/Jifty/Plugin/Authentication/Facebook/Dispatcher.pm is in libjifty-plugin-authentication-facebook-perl 0.90000-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | use strict;
use warnings;
package Jifty::Plugin::Authentication::Facebook::Dispatcher;
use Jifty::Dispatcher -base;
=head1 NAME
Jifty::Plugin::Authentication::Facebook::Dispatcher - dispatcher for facebook plugin
=head1 DESCRIPTION
All the dispatcher rules jifty needs to support L<Jifty::Authentication::Facebook>
=head1 RULES
=head2 before '/facebook/callback'
Handles the login callback. You probably don't need to worry about this.
=cut
before qr'^/facebook/callback(_link)?' => run {
my $link = $1 ? 1 : 0;
my $action = $link ? 'LinkFacebookUser' : 'LoginFacebookUser';
my $moniker = $link ? 'facebooklink' : 'facebooklogin';
Jifty->web->request->add_action(
moniker => $moniker,
class => $action,
arguments => {
auth_token => get('auth_token'),
}
);
if ( Jifty->web->request->continuation ) {
Jifty->web->request->continuation->call;
}
else {
redirect '/';
}
};
=head2 before '/facebook/force_login'
Redirects user to the Facebook login page. Useful if you want to skip
prompting the user to login on your app.
=cut
before '/facebook/force_login' => run {
my ($plugin) = Jifty->find_plugin('Jifty::Plugin::Authentication::Facebook');
Jifty->web->_redirect( $plugin->get_login_url );
};
=head2 before '/facebook/logout'
Directing a user here will log him out of the app and Facebook.
=cut
before '/facebook/logout' => run {
if ( Jifty->web->current_user->id ) {
Jifty->web->current_user( undef );
my ($plugin) = Jifty->find_plugin('Jifty::Plugin::Authentication::Facebook');
$plugin->api->auth->logout;
};
redirect '/';
};
1;
|