1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace GoetasWebservices\SoapServices\SoapClient\WssWsSecurity; |
4
|
|
|
|
5
|
|
|
class Security |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* (UT 3.1) Password type: plain text. |
9
|
|
|
*/ |
10
|
|
|
const PASSWORD_TYPE_TEXT = 0; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* (UT 3.1) Password type: digest. |
14
|
|
|
*/ |
15
|
|
|
const PASSWORD_TYPE_DIGEST = 1; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* (UT 3.1) Password. |
19
|
|
|
* |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
protected $password; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* (UT 3.1) Password type: text or digest. |
26
|
|
|
* |
27
|
|
|
* @var int |
28
|
|
|
*/ |
29
|
|
|
protected $passwordType = self::PASSWORD_TYPE_DIGEST; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* (UT 3.1) Username. |
33
|
|
|
* |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
protected $username; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* (SMS 10) Add security timestamp. |
40
|
|
|
* |
41
|
|
|
* @var boolean |
42
|
|
|
*/ |
43
|
|
|
protected $addTimestamp = true; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* (UT 3.1) Username. |
47
|
|
|
* |
48
|
|
|
* @var \DateTime |
49
|
|
|
*/ |
50
|
|
|
protected $timestamp; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* (SMS 10) Security timestamp expires time in seconds. |
54
|
|
|
* |
55
|
|
|
* @var int |
56
|
|
|
*/ |
57
|
|
|
protected $expires = 300; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
|
|
public function getPassword() |
63
|
|
|
{ |
64
|
|
|
return $this->password; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return \DateTime |
69
|
|
|
*/ |
70
|
|
|
public function getTimestamp() |
71
|
|
|
{ |
72
|
|
|
return $this->timestamp; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param \DateTime $timestamp |
77
|
|
|
*/ |
78
|
|
|
public function setTimestamp(\DateTime $timestamp) |
79
|
|
|
{ |
80
|
|
|
$this->timestamp = $timestamp; |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @param string $password |
85
|
|
|
* @param int $passwordType |
86
|
|
|
*/ |
87
|
|
|
public function setPassword($password, $passwordType = self::PASSWORD_TYPE_DIGEST) |
88
|
|
|
{ |
89
|
|
|
$this->password = $password; |
90
|
|
|
$this->passwordType = $passwordType; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @return int |
95
|
|
|
*/ |
96
|
|
|
public function getPasswordType() |
97
|
|
|
{ |
98
|
|
|
return $this->passwordType; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return string |
103
|
|
|
*/ |
104
|
|
|
public function getUsername() |
105
|
|
|
{ |
106
|
|
|
return $this->username; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param string $username |
111
|
|
|
*/ |
112
|
|
|
public function setUsername($username) |
113
|
|
|
{ |
114
|
|
|
$this->username = $username; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @return bool |
119
|
|
|
*/ |
120
|
|
|
public function isAddTimestamp() |
121
|
|
|
{ |
122
|
|
|
return $this->addTimestamp; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* @param bool $addTimestamp |
127
|
|
|
*/ |
128
|
|
|
public function setAddTimestamp($addTimestamp) |
129
|
|
|
{ |
130
|
|
|
$this->addTimestamp = $addTimestamp; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* @return int |
135
|
|
|
*/ |
136
|
|
|
public function getExpires() |
137
|
|
|
{ |
138
|
|
|
return $this->expires; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* @param int $expires |
143
|
|
|
*/ |
144
|
|
|
public function setExpires($expires) |
145
|
|
|
{ |
146
|
|
|
$this->expires = $expires; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
|
150
|
|
|
} |
151
|
|
|
|