|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Copyright (C) 2016 SURFnet. |
|
4
|
|
|
* |
|
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
6
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
7
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
8
|
|
|
* License, or (at your option) any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* This program is distributed in the hope that it will be useful, |
|
11
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13
|
|
|
* GNU Affero General Public License for more details. |
|
14
|
|
|
* |
|
15
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
16
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
namespace SURFnet\VPN\Common\HttpClient; |
|
20
|
|
|
|
|
21
|
|
|
class ServerClient extends BaseClient |
|
22
|
|
|
{ |
|
23
|
|
|
public function __construct(HttpClientInterface $httpClient, $baseUri) |
|
24
|
|
|
{ |
|
25
|
|
|
parent::__construct($httpClient, $baseUri); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function getClientConnections() |
|
29
|
|
|
{ |
|
30
|
|
|
return $this->get('client_connections'); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function getLog(array $p) |
|
|
|
|
|
|
34
|
|
|
{ |
|
35
|
|
|
return $this->get('log', $p); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function getStats() |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->get('stats'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function postAddClientCertificate(array $p) |
|
|
|
|
|
|
44
|
|
|
{ |
|
45
|
|
|
return $this->post('add_client_certificate', $p); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function postAddServerCertificate(array $p) |
|
|
|
|
|
|
49
|
|
|
{ |
|
50
|
|
|
return $this->post('add_server_certificate', $p); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getClientCertificateList(array $p) |
|
|
|
|
|
|
54
|
|
|
{ |
|
55
|
|
|
return $this->get('client_certificate_list', $p); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function getClientCertificateInfo(array $p) |
|
|
|
|
|
|
59
|
|
|
{ |
|
60
|
|
|
return $this->get('client_certificate_info', $p); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function postEnableUser(array $p) |
|
|
|
|
|
|
64
|
|
|
{ |
|
65
|
|
|
return $this->post('enable_user', $p); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function getUserList() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->get('user_list'); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function postDisableUser(array $p) |
|
|
|
|
|
|
74
|
|
|
{ |
|
75
|
|
|
return $this->post('disable_user', $p); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function getIsDisabledUser(array $p) |
|
|
|
|
|
|
79
|
|
|
{ |
|
80
|
|
|
return $this->get('is_disabled_user', $p); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function postDisableClientCertificate(array $p) |
|
|
|
|
|
|
84
|
|
|
{ |
|
85
|
|
|
return $this->post('disable_client_certificate', $p); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function postDeleteClientCertificate(array $p) |
|
|
|
|
|
|
89
|
|
|
{ |
|
90
|
|
|
return $this->post('delete_client_certificate', $p); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function postEnableClientCertificate(array $p) |
|
|
|
|
|
|
94
|
|
|
{ |
|
95
|
|
|
return $this->post('enable_client_certificate', $p); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function postKillClient(array $p) |
|
|
|
|
|
|
99
|
|
|
{ |
|
100
|
|
|
return $this->post('kill_client', $p); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function getInstanceNumber() |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->get('instance_number'); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function getProfileList() |
|
109
|
|
|
{ |
|
110
|
|
|
return $this->get('profile_list'); |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public function getHasTotpSecret(array $p) |
|
|
|
|
|
|
114
|
|
|
{ |
|
115
|
|
|
return $this->get('has_totp_secret', $p); |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
public function getHasVootToken(array $p) |
|
|
|
|
|
|
119
|
|
|
{ |
|
120
|
|
|
return $this->get('has_voot_token', $p); |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
public function getUserGroups(array $p) |
|
|
|
|
|
|
124
|
|
|
{ |
|
125
|
|
|
return $this->get('user_groups', $p); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
public function getSystemMessages($messageType) |
|
129
|
|
|
{ |
|
130
|
|
|
return $this->get('system_messages', ['message_type' => $messageType]); |
|
131
|
|
|
} |
|
132
|
|
|
|
|
133
|
|
|
public function postAddSystemMessage($messageType, $messageBody) |
|
134
|
|
|
{ |
|
135
|
|
|
return $this->post('add_system_message', ['message_type' => $messageType, 'message_body' => $messageBody]); |
|
136
|
|
|
} |
|
137
|
|
|
|
|
138
|
|
|
public function postDeleteSystemMessage($messageId) |
|
139
|
|
|
{ |
|
140
|
|
|
return $this->post('delete_system_message', ['message_id' => $messageId]); |
|
141
|
|
|
} |
|
142
|
|
|
|
|
143
|
|
|
public function getUserMessages($userId) |
|
144
|
|
|
{ |
|
145
|
|
|
return $this->get('user_messages', ['user_id' => $userId]); |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
public function postSetVootToken(array $p) |
|
|
|
|
|
|
149
|
|
|
{ |
|
150
|
|
|
return $this->post('set_voot_token', $p); |
|
151
|
|
|
} |
|
152
|
|
|
|
|
153
|
|
|
public function postDeleteTotpSecret(array $p) |
|
|
|
|
|
|
154
|
|
|
{ |
|
155
|
|
|
return $this->post('delete_totp_secret', $p); |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
public function postSetTotpSecret(array $p) |
|
|
|
|
|
|
159
|
|
|
{ |
|
160
|
|
|
return $this->post('set_totp_secret', $p); |
|
161
|
|
|
} |
|
162
|
|
|
|
|
163
|
|
|
public function postVerifyTotpKey(array $p) |
|
|
|
|
|
|
164
|
|
|
{ |
|
165
|
|
|
return $this->post('verify_totp_key', $p); |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
public function postConnect(array $p) |
|
|
|
|
|
|
169
|
|
|
{ |
|
170
|
|
|
return $this->post('connect', $p); |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
public function postDisconnect(array $p) |
|
|
|
|
|
|
174
|
|
|
{ |
|
175
|
|
|
return $this->post('disconnect', $p); |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
public function postVerifyOtp(array $p) |
|
|
|
|
|
|
179
|
|
|
{ |
|
180
|
|
|
return $this->post('verify_otp', $p); |
|
181
|
|
|
} |
|
182
|
|
|
} |
|
183
|
|
|
|
Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.