| 1 | package OAuth::Lite2::Server::GrantHandlers; | ||
| 2 | |||
| 3 | 7 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 7 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 7 | ▶ | use OAuth::Lite2::Server::GrantHandler::AuthorizationCode; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 7 | ▶ | use OAuth::Lite2::Server::GrantHandler::Password; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 7 | ▶ | use OAuth::Lite2::Server::GrantHandler::RefreshToken; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 7 | ▶ | use OAuth::Lite2::Server::GrantHandler::ClientCredentials; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 7 | ▶ | use OAuth::Lite2::Server::GrantHandler::GroupingRefreshToken; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | 7 | ▶ | use OAuth::Lite2::Server::GrantHandler::ServerState; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 7 | ▶ | use OAuth::Lite2::Server::GrantHandler::ExternalService; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 7 | my %HANDLERS; | |
| 15 | |||
| 16 | 49 | ▶ | sub add_handler { |
|
Subroutine
add_handler: called CC=1 SCAR=0.0
Pod
documented
| |||
| 17 | 49 | my ($class, $type, $handler) = @_; | |
| 18 | 49 | $HANDLERS{$type} = $handler; | |
| 19 | } | ||
| 20 | |||
| 21 | 7 | __PACKAGE__->add_handler( 'authorization_code' => | |
| 22 | OAuth::Lite2::Server::GrantHandler::AuthorizationCode->new ); | ||
| 23 | 7 | __PACKAGE__->add_handler( 'password' => | |
| 24 | OAuth::Lite2::Server::GrantHandler::Password->new ); | ||
| 25 | 7 | __PACKAGE__->add_handler( 'refresh_token' => | |
| 26 | OAuth::Lite2::Server::GrantHandler::RefreshToken->new ); | ||
| 27 | 7 | __PACKAGE__->add_handler( 'client_credentials' => | |
| 28 | OAuth::Lite2::Server::GrantHandler::ClientCredentials->new ); | ||
| 29 | # Grant types which is not defined in RFC | ||
| 30 | 7 | __PACKAGE__->add_handler( 'grouping_refresh_token' => | |
| 31 | OAuth::Lite2::Server::GrantHandler::GroupingRefreshToken->new ); | ||
| 32 | 7 | __PACKAGE__->add_handler( 'server_state' => | |
| 33 | OAuth::Lite2::Server::GrantHandler::ServerState->new ); | ||
| 34 | 7 | __PACKAGE__->add_handler( 'external_service' => | |
| 35 | OAuth::Lite2::Server::GrantHandler::ExternalService->new ); | ||
| 36 | |||
| 37 | #__PACKAGE__->add_handler( 'assertion' => ); | ||
| 38 | #__PACKAGE__->add_handler( 'none' => ); | ||
| 39 | |||
| 40 | 12 | ▶ | sub get_handler { |
|
Subroutine
get_handler: called CC=1 SCAR=0.0
Pod
documented
| |||
| 41 | 12 | my ($class, $type) = @_; | |
| 42 | 12 | return $HANDLERS{$type}; | |
| 43 | } | ||
| 44 | |||
| 45 | =head1 NAME | ||
| 46 | |||
| 47 | OAuth::Lite2::Server::GrantHandlers - store of handlers for each grant_type. | ||
| 48 | |||
| 49 | =head1 SYNOPSIS | ||
| 50 | |||
| 51 | my $handler = OAuth::Lite2::Server::GrantHandlers->get_handler( $grant_type ); | ||
| 52 | $handler->handle_request( $ctx ); | ||
| 53 | |||
| 54 | =head1 DESCRIPTION | ||
| 55 | |||
| 56 | store of handlers for each grant_type. | ||
| 57 | |||
| 58 | =head1 METHODS | ||
| 59 | |||
| 60 | =head2 add_handler( $grant_type, $handler ) | ||
| 61 | |||
| 62 | add GrantHandler instance | ||
| 63 | |||
| 64 | =head2 get_handler( $grant_type ) | ||
| 65 | |||
| 66 | get GrantHandler instance | ||
| 67 | |||
| 68 | =head1 SEE ALSO | ||
| 69 | |||
| 70 | L<OAuth::Lite2::Server::GrantHandler> | ||
| 71 | L<OAuth::Lite2::Server::GrantHandler::AuthorizationCode> | ||
| 72 | L<OAuth::Lite2::Server::GrantHandler::ClientCredentials> | ||
| 73 | L<OAuth::Lite2::Server::GrantHandler::Password> | ||
| 74 | L<OAuth::Lite2::Server::GrantHandler::RefreshToken> | ||
| 75 | L<OAuth::Lite2::Server::GrantHandler::GroupingRefreshToken> | ||
| 76 | L<OAuth::Lite2::Server::GrantHandler::ServerState> | ||
| 77 | L<OAuth::Lite2::Server::GrantHandler::ExternalService> | ||
| 78 | |||
| 79 | =head1 AUTHOR | ||
| 80 | |||
| 81 | Ryo Ito, E<lt>ritou.06@gmail.comE<gt> | ||
| 82 | |||
| 83 | Lyo Kato, E<lt>lyo.kato@gmail.comE<gt> | ||
| 84 | |||
| 85 | =head1 COPYRIGHT AND LICENSE | ||
| 86 | |||
| 87 | Copyright (C) 2010 by Lyo Kato | ||
| 88 | |||
| 89 | This library is free software; you can redistribute it and/or modify | ||
| 90 | it under the same terms as Perl itself, either Perl version 5.8.8 or, | ||
| 91 | at your option, any later version of Perl 5 you may have available. | ||
| 92 | |||
| 93 | =cut | ||
| 94 | |||
| 95 | 7 | 1; | |
| 96 | |||