| 1 | package CatalystX::OAuth2::Provider; | ||
| 2 | 2 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 2 | ▶ | use CatalystX::InjectComponent; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | our $VERSION = '0.0005'; | |
| 7 | |||
| 8 | 1 | ▶ | after 'setup_components' => sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 9 | 1 | my $class = shift; | |
| 10 | 1 | CatalystX::InjectComponent->inject( | |
| 11 | into => $class, | ||
| 12 | component => 'CatalystX::OAuth2::Provider::Controller::OAuth', | ||
| 13 | as => 'Controller::OAuth', | ||
| 14 | ); | ||
| 15 | |||
| 16 | 2 | }; | |
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | CatalystX::OAuth2::Provider - | ||
| 21 | |||
| 22 | =head1 VERSION | ||
| 23 | Version 0.0005 | ||
| 24 | |||
| 25 | =head1 SYNOPSIS | ||
| 26 | |||
| 27 | package MyApp; | ||
| 28 | use Moose; | ||
| 29 | use namespace::autoclean; | ||
| 30 | |||
| 31 | use Catalyst qw/ | ||
| 32 | +CatalystX::OAuth2::Provider | ||
| 33 | Authentication | ||
| 34 | Session | ||
| 35 | Session::Store::File | ||
| 36 | Session::State::Cookie | ||
| 37 | Session::State::URI | ||
| 38 | Session::State::Auth | ||
| 39 | /; | ||
| 40 | |||
| 41 | extends 'Catalyst'; | ||
| 42 | |||
| 43 | __PACKAGE__->config( | ||
| 44 | 'Plugin::Authentication' => { # Auth config here } | ||
| 45 | ); | ||
| 46 | |||
| 47 | __PACKAGE__->config( | ||
| 48 | 'Plugin::Session' => { param => 'code', rewrite_body => 0 }, #Handle authorization code | ||
| 49 | ); | ||
| 50 | |||
| 51 | __PACKAGE__->config( | ||
| 52 | 'Controller::OAuth' => { | ||
| 53 | login_form => { | ||
| 54 | template => 'user/login.tt', | ||
| 55 | field_names => { | ||
| 56 | username => 'mail', | ||
| 57 | password => 'userPassword' | ||
| 58 | } | ||
| 59 | }, | ||
| 60 | authorize_form => { | ||
| 61 | template => 'oauth/authorize.tt', | ||
| 62 | }, | ||
| 63 | auth_info => { | ||
| 64 | client_1 => { | ||
| 65 | client_id => q{THIS_IS_ID}, | ||
| 66 | client_secret => q{THIS_IS_SECRET}, | ||
| 67 | redirect_uri => q{CLIENT_REDIRECT_URI}, | ||
| 68 | }, | ||
| 69 | }, | ||
| 70 | protected_resource => { | ||
| 71 | secret_key => 'secret', | ||
| 72 | } | ||
| 73 | } | ||
| 74 | ); | ||
| 75 | |||
| 76 | |||
| 77 | =head1 DESCRIPTION | ||
| 78 | |||
| 79 | CatalystX::OAuth2::Provider is an application class provides a OAuth2 Provider in only | ||
| 80 | your Catalyst application configuration. | ||
| 81 | |||
| 82 | =head1 REQUIREMENTS | ||
| 83 | |||
| 84 | =over | ||
| 85 | |||
| 86 | =item A Catalyst application | ||
| 87 | |||
| 88 | =item A working Authentication configuration | ||
| 89 | |||
| 90 | =item A working Session configuration | ||
| 91 | |||
| 92 | =item A View | ||
| 93 | |||
| 94 | =back | ||
| 95 | |||
| 96 | =head1 METHODS | ||
| 97 | |||
| 98 | =head1 BUGS | ||
| 99 | |||
| 100 | =head1 AUTHOR | ||
| 101 | |||
| 102 | zdk (Warachet Samtalee) | ||
| 103 | |||
| 104 | =head1 COPYRIGHT & LICENSE | ||
| 105 | |||
| 106 | Copyright 2011 the above author(s). | ||
| 107 | |||
| 108 | This sofware is free software, and is licensed under the same terms as perl itself. | ||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | 2 | 1; | |