OxdPackages/UmaRpGetRpt.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 66 CC 3 SCAR 11.2
CC
3
Cov
0%
setRequestOxdId
6.0
setRequestForceNew
6.0
new
2.0
CRAP 3.1
1 #!/usr/bin/perl
2  
3 ##
4 # Gluu-oxd-library
5 #
6 # An open source application library for PHP
7 #
8 # This content is released under the MIT License (MIT)
9 #
10 # Copyright (c) 2016, Gluu inc, USA, Austin
11 #
12 # Permission is hereby granted, free of charge, to any person obtaining a copy
13 # of this software and associated documentation files (the "Software"), to deal
14 # in the Software without restriction, including without limitation the rights
15 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16 # copies of the Software, and to permit persons to whom the Software is
17 # furnished to do so, subject to the following conditions:
18 #
19 # The above copyright notice and this permission notice shall be included in
20 # all copies or substantial portions of the Software.
21 #
22 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28 # THE SOFTWARE.
29 #
30 # @package Gluu-oxd-library
31 # @version 2.4.4
32 # @author Inderpal Singh
33 # @author inderpal@ourdesignz.com
34 # @copyright Copyright (c) 2016, Gluu inc federation (https://gluu.org/)
35 # @license http://opensource.org/licenses/MIT MIT License
36 # @link https://gluu.org/
37 # @since Version 2.4.4
38 # @filesource
39 #
40  
41 ##
42 # UMA RP - Get Rpt class
43 #
44 # Class is connecting to oxd-server via socket, and getting GAT from gluu-server.
45 #
46 # @package Gluu-oxd-library
47 # @subpackage Libraries
48 # @category Relying Party (RP) and User Managed Access (UMA)
49 # @author Inderpal Singh
50 # @author inderpal@ourdesignz.com
51 # @see OxdClientSocket
52 # @see OxdClient
53 # @see OxdConfig
54 #/
55  
56 package UmaRpGetRpt;
57 use vars qw($VERSION);
58 $VERSION = '0.01';
59 use OxdPackages::OxdClient;
60 use base qw(OxdClient Class::Accessor);
61 use strict;
62 our @ISA = qw(OxdClient); # inherits from OxdClient
63 use Data::Dumper;
64
65 sub new {
66 my $class = shift;
67 my $self = {
68
69 # @var string $request_oxd_id This parameter you must get after registration site in gluu-server
70 _request_oxd_id => shift,
71
72 # @var bool $request_force_new Indicates whether return new RPT, in general should be false, so oxd server can cache/reuse same RPT
73 _request_force_new => shift,
74
75
76 # Response parameter from oxd-server
77 # Gluu RP Token
78 # @var string $response_rpt
79
80 _response_rpt => shift
81 };
82 # Print all the values just for clarification.
83 # print "First Name is $self->{_request_oxd_id}\n";
84
85 # print "<br>";
86 bless $self, $class;
87 return $self;
88 }
89
90 # @return string
91 sub getRequestOxdId
92 {
93 my( $self ) = @_;
94 return $self->{_request_oxd_id}
95 }
96  
97 ##
98 # @param string $request_oxd_id
99 # @return void
100 #
101 sub setRequestOxdId
102 {
103 my ( $self, $request_oxd_id ) = @_;
104 $self->{_request_oxd_id} = $request_oxd_id if defined($request_oxd_id);
105 return $self->{_request_oxd_id};
106 }
107  
108 ##
109 # @return bool
110 #
111 sub getRequestForceNew
112 {
113 my( $self ) = @_;
114 return $self->{_request_force_new};
115 }
116  
117 ##
118 # @param bool $request_force_new
119 # @return void
120 #
121 sub setRequestForceNew
122 {
123 my ( $self, $request_force_new ) = @_;
124 $self->{_request_force_new} = $request_force_new if defined($request_force_new);
125 return $self->{_request_force_new};
126 }
127  
128 ##
129 # @return string
130 #
131 sub getResponseRpt
132 {
133 my( $self ) = @_;
134 $self->{_response_rpt} = $self->getResponseData()->{rpt};
135 return $self->{_response_rpt};
136 }
137  
138 ##
139 # Protocol command to oxd server
140 # @return void
141 #
142 sub setCommand
143 {
144 my ( $self ) = @_;
145 $self->{_command} = 'uma_rp_get_rpt';
146 }
147  
148 ##
149 # Protocol parameter to oxd server
150 # @return void
151 #
152 sub setParams
153 {
154 my ( $self, $params ) = @_;
155 my $paramsArray = {
156 "oxd_id" => $self->getRequestOxdId(),
157 "force_new" => $self->getRequestForceNew()
158  
159 };
160 $self->{_params} = $paramsArray;
161 return $self->{_params};
162 }
163  
164 1; # this 1; is neccessary for our class to work