OxdPackages/UmaRpGetGat.pm untested

filter: Statementstmt 0.0% 0 / 40 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 / 65 CC 3 SCAR 11.2
CC
3
Cov
0%
setRequestOxdId
6.0
setRequestScopes
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 GAT 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 UmaRpGetGat;
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 array $request_scopes RP should know required scopes in advance
73 _request_scopes => shift,
74
75 # Response parameter from oxd-server
76 # GAT stands for Gluu Access Token
77 # @var string $response_gat
78 _response_gat => shift
79 };
80 # Print all the values just for clarification.
81 # print "First Name is $self->{_request_oxd_id}\n";
82
83 # print "<br>";
84 bless $self, $class;
85 return $self;
86 }
87
88 # @return string
89 sub getRequestOxdId
90 {
91 my( $self ) = @_;
92 return $self->{_request_oxd_id};
93 }
94  
95 # @param string $request_oxd_id
96 # @return void
97 sub setRequestOxdId
98 {
99 my ( $self, $request_oxd_id ) = @_;
100 $self->{_request_oxd_id} = $request_oxd_id if defined($request_oxd_id);
101 return $self->{_request_oxd_id};
102 }
103  
104 # @return array
105 sub getRequestScopes
106 {
107 my( $self ) = @_;
108 return $self->{_request_scopes};
109 }
110  
111 # @param array $request_scopes
112 # @return void
113 sub setRequestScopes
114 {
115 my ( $self, $request_scopes ) = @_;
116 $self->{_request_scopes} = $request_scopes if defined($request_scopes);
117 return $self->{_request_scopes};
118 }
119  
120 # @return string
121 sub getResponseGat
122 {
123 my( $self ) = @_;
124 return $self->{_response_gat};
125 }
126  
127 # Protocol command to oxd server
128 # @return void
129 sub setCommand
130 {
131 my ( $self ) = @_;
132 $self->{_command} = 'uma_rp_get_gat';
133 }
134  
135 # Protocol parameter to oxd server
136 # @return void
137 sub setParams()
138 {
139 my ( $self, $params ) = @_;
140 my $paramsArray = {
141 "oxd_id" => $self->getRequestOxdId(),
142 "scopes" => $self->getRequestScopes()
143  
144 };
145 $self->{_params} = $paramsArray;
146 return $self->{_params};
147 }
148  
149 1; # this 1; is neccessary for our class to work