blib/lib/OAuth/Lite2/Server/GrantHandler/ServerState.pm

filter: Statementstmt 100% 29 / 29 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 87.5% 42 / 48 SCAR 13.9
CC
4
Cov
89%
handle_request
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« blib/lib/OAuth/Lite2/Formatter/XML.pm ↑ Summary blib/lib/OAuth/Lite2/Server/Error.pm »
1 package OAuth::Lite2::Server::GrantHandler::ServerState;
2  
3 8 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 ▶use parent 'OAuth::Lite2::Server::GrantHandler';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use OAuth::Lite2::Server::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use OAuth::Lite2::ParamMethod::AuthHeader;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 8 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub is_required_client_authentication {
12 1 ▶ return 0;
Subroutine is_required_client_authentication: called CC=1 SCAR=0.0
Pod documented
13 }
14  
15 sub handle_request {
16 2 ▶ my ($self, $dh) = @_;
Subroutine handle_request: called CC=4 SCAR=14.5
Pod documented
17  
18 2 my $req = $dh->request;
19  
20 2 my $parser = OAuth::Lite2::ParamMethod::AuthHeader->new;
21 2 my $header_credentials = $parser->basic_credentials($req);
22 2 ▶ my $client_id = ($header_credentials->{client_id}) ? $header_credentials->{client_id} : $req->param("client_id");
Branch: 1 branch
BranchTrueFalseTotal
$header_credentials->{'client_id'} ? : 0 2 2
23  
24 # create server_state
25 2 my $server_state = $dh->create_server_state(
26 client_id => $client_id,
27 );
28 2 ▶ Carp::croak "OAuth::Lite2::Server::DataHandler::create_server_state doesn't return OAuth::Lite2::Model::ServerState"
Branch: 1 branch
BranchTrueFalseTotal
unless $server_state and $server_state->isa("OAuth::Lite2::Model::ServerState") 0 2 2
Condition33%1/3
$server_state and $server_state->isa("OAuth::Lite2::Model::ServerState")
!ll&&!rl&&r
002
MC/DC0%0/2
$server_state and $server_state->isa("OAuth::Lite2::Model::ServerState")
$server_state $server_state->isa("OAuth::Lite2::Model::ServerState")
Truth table33%1/3
A and B
A= $server_stateB= $server_state->isa("OAuth::Lite2::Model::ServerState")
ABresult
0X0
100
111
29 unless ($server_state
30 && $server_state->isa("OAuth::Lite2::Model::ServerState"));
31  
32 2 my $res = {
33 server_state => $server_state->server_state,
34 expires_in => $server_state->expires_in
35 };
36 2 return $res;
37 }
38  
39 =head1 NAME
40  
41 OAuth::Lite2::Server::GrantHandler::ServerState - handler for 'server_state' grant_type request
42  
43 =head1 SYNOPSIS
44  
45 my $handler = OAuth::Lite2::Server::GrantHandler::ServerState->new;
46 my $res = $handler->handle_request( $data_handler );
47  
48 =head1 DESCRIPTION
49  
50 handler for 'server_state' grant_type request.
51  
52 =head1 METHODS
53  
54 =head2 handle_request( $req )
55  
56 See L<OAuth::Lite2::Server::GrantHandler> document.
57  
58 =head1 AUTHOR
59  
60 Ryo Ito, E<lt>ritou.06@gmail.comE<gt>
61  
62 Lyo Kato, E<lt>lyo.kato@gmail.comE<gt>
63  
64 =head1 COPYRIGHT AND LICENSE
65  
66 Copyright (C) 2010 by Lyo Kato
67  
68 This library is free software; you can redistribute it and/or modify
69 it under the same terms as Perl itself, either Perl version 5.8.8 or,
70 at your option, any later version of Perl 5 you may have available.
71  
72 =cut
73  
74 8 1;
« blib/lib/OAuth/Lite2/Formatter/XML.pm ↑ Summary blib/lib/OAuth/Lite2/Server/Error.pm »