1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2014 SURFnet bv |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
7
|
|
|
* you may not use this file except in compliance with the License. |
8
|
|
|
* You may obtain a copy of the License at |
9
|
|
|
* |
10
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
11
|
|
|
* |
12
|
|
|
* Unless required by applicable law or agreed to in writing, software |
13
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
14
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15
|
|
|
* See the License for the specific language governing permissions and |
16
|
|
|
* limitations under the License. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace Surfnet\StepupMiddlewareClient\Identity\Service; |
20
|
|
|
|
21
|
|
|
use Surfnet\StepupMiddlewareClient\Exception\AccessDeniedToResourceException; |
22
|
|
|
use Surfnet\StepupMiddlewareClient\Exception\MalformedResponseException; |
23
|
|
|
use Surfnet\StepupMiddlewareClient\Exception\ResourceReadException; |
24
|
|
|
use Surfnet\StepupMiddlewareClient\Identity\Dto\SecondFactorAuditLogSearchQuery; |
25
|
|
|
use Surfnet\StepupMiddlewareClient\Service\ApiService; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Provides remote read access to the Middleware's identity audit log. |
29
|
|
|
*/ |
30
|
|
|
class AuditLogService |
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* @var ApiService |
34
|
|
|
*/ |
35
|
|
|
private $apiService; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @param ApiService $apiService |
39
|
|
|
*/ |
40
|
|
|
public function __construct(ApiService $apiService) |
41
|
|
|
{ |
42
|
|
|
$this->apiService = $apiService; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @param SecondFactorAuditLogSearchQuery $query |
47
|
|
|
* @return null|array |
48
|
|
|
* @throws AccessDeniedToResourceException When the consumer isn't authorised to access given resource. |
49
|
|
|
* @throws ResourceReadException When the server doesn't respond with the resource. |
50
|
|
|
* @throws MalformedResponseException When the server doesn't respond with (well-formed) JSON. |
51
|
|
|
*/ |
52
|
|
|
public function searchSecondFactorAuditLog(SecondFactorAuditLogSearchQuery $query) |
53
|
|
|
{ |
54
|
|
|
return $this->apiService->read('audit-log/second-factors' . $query->toHttpQuery()); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|