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