OxdPackages/UmaIntrospectRpt.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 9 totaltotal 0.0% 0 / 70 CC 3 SCAR 11.0
CC
3
Cov
0%
setRequestOxdId
6.0
setRequestRPT
6.0
new
2.0
CRAP 3.0
1 #!/usr/bin/perl
2
3 ##
4 # Gluu-oxd-library
5 #
6 # An open source application library for Perl
7 #
8 # This content is released under the MIT License (MIT)
9 #
10 # Copyright (c) 2018, 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 3.1.3
32 # @author Sobhan Panda
33 # @author_email sobhan@centroxy.com
34 # @copyright Copyright (c) 2018, Gluu inc federation (https://gluu.org/)
35 # @license http://opensource.org/licenses/MIT MIT License
36 # @link https://gluu.org/
37 # @since Version 3.1.3
38 # @filesource
39 #
40
41
42 package UmaIntrospectRpt;
43 use vars qw($VERSION);
44 $VERSION = '0.01';
45 use OxdPackages::OxdClient;
46 use base qw(OxdClient Class::Accessor);
47 use strict;
48 our @ISA = qw(OxdClient); # inherits from OxdClient
49 use Data::Dumper;
50
51 sub new {
52 my $class = shift;
53 my $self = {
54
55 # @var string $request_oxd_id This parameter you must get after registration site in gluu-server
56 _request_oxd_id => shift,
57
58 _request_rpt => shift,
59
60
61 # Response parameter from oxd-server
62 #
63 # @var string $response_active
64
65 _response_active => shift,
66
67 };
68
69 # print "<br>";
70 bless $self, $class;
71 return $self;
72 }
73
74 # @return string
75 sub getRequestOxdId
76 {
77 my( $self ) = @_;
78 return $self->{_request_oxd_id}
79 }
80
81 ##
82 # @param string $request_oxd_id
83 # @return void
84 #
85 sub setRequestOxdId
86 {
87 my ( $self, $request_oxd_id ) = @_;
88 $self->{_request_oxd_id} = $request_oxd_id if defined($request_oxd_id);
89 return $self->{_request_oxd_id};
90 }
91
92
93 # @return string
94 sub getRequestRPT
95 {
96 my( $self ) = @_;
97 return $self->{_request_rpt}
98 }
99
100 ##
101 # @param string $request_rpt
102 # @return void
103 #
104 sub setRequestRPT
105 {
106 my ( $self, $request_rpt ) = @_;
107 $self->{_request_rpt} = $request_rpt if defined($request_rpt);
108 return $self->{_request_rpt};
109 }
110
111
112 ##
113 # @return string
114 #
115 sub getResponseActive
116 {
117 my( $self ) = @_;
118 $self->{_response_active} = $self->getResponseData()->{active};
119 return $self->{_response_active};
120 }
121
122
123 ##
124 # Protocol command to oxd server
125 # @return void
126 #
127 sub setCommand
128 {
129 my ( $self ) = @_;
130 $self->{_command} = 'introspect_rpt';
131 }
132
133 ##
134 # Protocol command to oxd to http server
135 # @return void
136 #
137 sub sethttpCommand
138 {
139 my ( $self ) = @_;
140 $self->{_httpcommand} = 'introspect-rpt';
141 }
142
143 # Method: setParams
144 # This method sets the parameters for introspect_rpt command.
145 # This module uses `request` method of OxdClient module for sending request to oxd-server
146 #
147 # Parameters:
148 #
149 # string $oxd_id - (Required) oxd Id from Client registration
150 #
151 # string $rpt - (Required) Request Party Token
152 #
153 # Returns:
154 # void
155 #
156 # This module uses `getResponseObject` method of OxdClient module for getting response from oxd.
157 #
158 # *Example response from getResponseObject:*
159 # --- Code
160 # { "status": "ok", "data": { "active": true, "exp": 1518091492556, "iat": 1518091192556, "nbf": null, "permissions": [{ "resource_id": "dd270f7b-551c-42e5-a1fa-a1811cff3f72", "resource_scopes": ["https://client.example.com:44300/api"], "exp": 1518094783755 }], "client_id": null, "sub": null, "aud": null, "iss": null, "jti": null } }
161 # ---
162 #
163 sub setParams
164 {
165 my ( $self, $params ) = @_;
166 my $paramsArray = {
167 "oxd_id" => $self->getRequestOxdId(),
168 "rpt" => $self->getRequestRPT()
169 };
170 $self->{_params} = $paramsArray;
171 return $self->{_params};
172 }
173
174 1; # this 1; is neccessary for our class to work