1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
* Caridea |
5
|
|
|
* |
6
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
7
|
|
|
* use this file except in compliance with the License. You may obtain a copy of |
8
|
|
|
* 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, WITHOUT |
14
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
15
|
|
|
* License for the specific language governing permissions and limitations under |
16
|
|
|
* the License. |
17
|
|
|
* |
18
|
|
|
* @copyright 2015-2018 LibreWorks contributors |
19
|
|
|
* @license Apache-2.0 |
20
|
|
|
*/ |
21
|
|
|
namespace Caridea\Auth\Event; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* An authentication resume event. This will only be published for non-anonymous principals. |
25
|
|
|
* |
26
|
|
|
* @copyright 2015-2018 LibreWorks contributors |
27
|
|
|
* @license Apache-2.0 |
28
|
|
|
*/ |
29
|
|
|
class Resume extends \Caridea\Auth\Event |
30
|
|
|
{ |
31
|
|
|
/** |
32
|
|
|
* @var float The authenticated first active time |
33
|
|
|
*/ |
34
|
|
|
protected $firstActive; |
35
|
|
|
/** |
36
|
|
|
* @var float The authenticated most recent active time |
37
|
|
|
*/ |
38
|
|
|
protected $lastActive; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Creates a new resume event. |
42
|
|
|
* |
43
|
|
|
* @param \Caridea\Auth\Service $source The source of the event. Cannot be null. |
44
|
|
|
* @param \Caridea\Auth\Principal $principal The authenticated principal |
45
|
|
|
* @param float $firstActive The authenticated first active time |
46
|
|
|
* @param float $lastActive The authenticated most recent active time |
47
|
|
|
*/ |
48
|
2 |
|
public function __construct(\Caridea\Auth\Service $source, \Caridea\Auth\Principal $principal, float $firstActive, float $lastActive) |
49
|
|
|
{ |
50
|
2 |
|
parent::__construct($source, $principal); |
51
|
2 |
|
$this->firstActive = $firstActive; |
52
|
2 |
|
$this->lastActive = $lastActive; |
53
|
2 |
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Gets the authenticated first active time. |
57
|
|
|
* |
58
|
|
|
* @return float The authenticated first active time |
59
|
|
|
*/ |
60
|
2 |
|
public function getFirstActive(): float |
61
|
|
|
{ |
62
|
2 |
|
return $this->firstActive; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Gets the authenticated most recent active time. |
67
|
|
|
* |
68
|
|
|
* @return float The authenticated most recent active time |
69
|
|
|
*/ |
70
|
2 |
|
public function getLastActive(): float |
71
|
|
|
{ |
72
|
2 |
|
return $this->lastActive; |
73
|
|
|
} |
74
|
|
|
} |
75
|
|
|
|