1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2016 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\StepupSelfService\SelfServiceBundle\Security\Authentication; |
20
|
|
|
|
21
|
|
|
use Surfnet\StepupSelfService\SelfServiceBundle\Exception\LogicException; |
22
|
|
|
use Surfnet\StepupSelfService\SelfServiceBundle\Value\DateTime; |
23
|
|
|
|
24
|
|
|
interface AuthenticatedSessionStateHandler |
25
|
|
|
{ |
26
|
|
|
/** |
27
|
|
|
* Sets the moment at which the user was authenticated |
28
|
|
|
* |
29
|
|
|
* @return void |
30
|
|
|
* @throws LogicException when an authentication moment was already logged |
31
|
|
|
*/ |
32
|
|
|
public function logAuthenticationMoment(); |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return bool |
36
|
|
|
*/ |
37
|
|
|
public function isAuthenticationMomentLogged(); |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Gets the moment at which the user was authenticated |
41
|
|
|
* |
42
|
|
|
* @return DateTime |
43
|
|
|
* @throws LogicException when no authentication moment was logged |
44
|
|
|
*/ |
45
|
|
|
public function getAuthenticationMoment(); |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Updates the last interaction moment to the current moment |
49
|
|
|
* |
50
|
|
|
* @return void |
51
|
|
|
*/ |
52
|
|
|
public function updateLastInteractionMoment(); |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Retrieves the last interaction moment |
56
|
|
|
* |
57
|
|
|
* @return DateTime |
58
|
|
|
*/ |
59
|
|
|
public function getLastInteractionMoment(); |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return bool |
63
|
|
|
*/ |
64
|
|
|
public function hasSeenInteraction(); |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param string $uri |
68
|
|
|
*/ |
69
|
|
|
public function setCurrentRequestUri($uri); |
|
|
|
|
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @return string |
73
|
|
|
*/ |
74
|
|
|
public function getCurrentRequestUri(); |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Migrates the current session to a new session id while maintaining all |
78
|
|
|
* session attributes. |
79
|
|
|
*/ |
80
|
|
|
public function migrate(); |
|
|
|
|
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Invalidates the session |
84
|
|
|
* |
85
|
|
|
* Clears all session attributes and flashes and regenerates the |
86
|
|
|
* session and deletes the old session from persistence |
87
|
|
|
*/ |
88
|
|
|
public function invalidate(); |
|
|
|
|
89
|
|
|
} |
90
|
|
|
|
For interface and abstract methods, it is impossible to infer the return type from the immediate code. In these cases, it is generally advisible to explicitly annotate these methods with a
@return
doc comment to communicate to implementors of these methods what they are expected to return.