|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* amadeus-ws-client |
|
4
|
|
|
* |
|
5
|
|
|
* Copyright 2015 Amadeus Benelux NV |
|
6
|
|
|
* |
|
7
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
8
|
|
|
* you may not use this file except in compliance with the License. |
|
9
|
|
|
* You may obtain a copy of the License at |
|
10
|
|
|
* |
|
11
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
12
|
|
|
* |
|
13
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
14
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
15
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
16
|
|
|
* See the License for the specific language governing permissions and |
|
17
|
|
|
* limitations under the License. |
|
18
|
|
|
* |
|
19
|
|
|
* @package Amadeus |
|
20
|
|
|
* @license https://opensource.org/licenses/Apache-2.0 Apache 2.0 |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
namespace Amadeus\Client\Params; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* AuthParams defines necessary authentication parameters for Amadeus Web Service client authentication. |
|
27
|
|
|
* |
|
28
|
|
|
* @package Amadeus\Client\Params |
|
29
|
|
|
* @author Dieter Devlieghere <[email protected]> |
|
30
|
|
|
*/ |
|
31
|
|
|
class AuthParams |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* The Amadeus Office ID to sign in to |
|
35
|
|
|
* |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
public $officeId; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Originator Typecode |
|
42
|
|
|
* |
|
43
|
|
|
* @var string |
|
44
|
|
|
*/ |
|
45
|
|
|
public $originatorTypeCode = "U"; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Duty code |
|
49
|
|
|
* |
|
50
|
|
|
* @var string |
|
51
|
|
|
*/ |
|
52
|
|
|
public $dutyCode = "SU"; |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* User ID / Originator |
|
56
|
|
|
* |
|
57
|
|
|
* @var string |
|
58
|
|
|
*/ |
|
59
|
|
|
public $userId; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Organization ID |
|
63
|
|
|
* |
|
64
|
|
|
* @var string |
|
65
|
|
|
*/ |
|
66
|
|
|
public $organizationId; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* Password Length of plain password. |
|
70
|
|
|
* |
|
71
|
|
|
* Only for SoapHeader < 4. |
|
72
|
|
|
* |
|
73
|
|
|
* @var int |
|
74
|
|
|
*/ |
|
75
|
|
|
public $passwordLength; |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* Password Data (base-64 encoded password) |
|
79
|
|
|
* |
|
80
|
|
|
* @var string |
|
81
|
|
|
*/ |
|
82
|
|
|
public $passwordData; |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* Custom Nonce base to use when generating nonces for authentication |
|
86
|
|
|
* |
|
87
|
|
|
* Only applies to Soap Header V4 |
|
88
|
|
|
* |
|
89
|
|
|
* If you do not provide one, the Session HandlerFactory will generate a random string. |
|
90
|
|
|
* |
|
91
|
|
|
* @var string |
|
92
|
|
|
*/ |
|
93
|
|
|
public $nonceBase; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* @param array $params |
|
97
|
|
|
*/ |
|
98
|
365 |
|
public function __construct($params = []) |
|
99
|
|
|
{ |
|
100
|
365 |
|
$this->loadFromArray($params); |
|
101
|
365 |
|
} |
|
102
|
|
|
|
|
103
|
|
|
/** |
|
104
|
|
|
* Load parameters from an associative array |
|
105
|
|
|
* |
|
106
|
|
|
* @param array $params |
|
107
|
|
|
* @return void |
|
108
|
|
|
*/ |
|
109
|
365 |
|
protected function loadFromArray(array $params) |
|
110
|
|
|
{ |
|
111
|
365 |
|
if (count($params) > 0) { |
|
112
|
365 |
|
$this->officeId = $params['officeId']; |
|
113
|
365 |
|
$this->originatorTypeCode = (isset($params['originatorTypeCode'])) ? $params['originatorTypeCode'] : "U"; |
|
114
|
365 |
|
$this->dutyCode = (isset($params['dutyCode'])) ? $params['dutyCode'] : "SU"; |
|
115
|
365 |
|
$this->userId = $params['userId']; |
|
116
|
365 |
|
$this->organizationId = (isset($params['organizationId'])) ? $params['organizationId'] : null; |
|
117
|
365 |
|
$this->passwordLength = (isset($params['passwordLength'])) ? $params['passwordLength'] : null; |
|
118
|
365 |
|
$this->passwordData = $params['passwordData']; |
|
119
|
|
|
|
|
120
|
365 |
|
if (isset($params['nonceBase'])) { |
|
121
|
5 |
|
$this->nonceBase = $params['nonceBase']; |
|
122
|
2 |
|
} |
|
123
|
146 |
|
} |
|
124
|
365 |
|
} |
|
125
|
|
|
} |
|
126
|
|
|
|