1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Copyright 2018 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\StepupBundle\Service; |
20
|
|
|
|
21
|
|
|
use Surfnet\StepupBundle\Command\SendSmsChallengeCommand; |
22
|
|
|
use Surfnet\StepupBundle\Command\VerifyPossessionOfPhoneCommand; |
23
|
|
|
use Surfnet\StepupBundle\Service\SmsSecondFactor\OtpVerification; |
24
|
|
|
|
25
|
|
|
interface SmsSecondFactorServiceInterface |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* The remaining number of requests as an integer value. |
29
|
|
|
* @return int |
30
|
|
|
*/ |
31
|
|
|
public function getOtpRequestsRemainingCount(); |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Return the number of OTP requests that can be taken as an integer value. |
35
|
|
|
* @return int |
36
|
|
|
*/ |
37
|
|
|
public function getMaximumOtpRequestsCount(); |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Tests if this session has made prior requests |
41
|
|
|
* @return bool |
42
|
|
|
*/ |
43
|
|
|
public function hasSmsVerificationState(); |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Clears the verification state, forget this user has performed SMS requests. |
47
|
|
|
* @return mixed |
48
|
|
|
*/ |
49
|
|
|
public function clearSmsVerificationState(); |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Send an SMS OTP challenge |
53
|
|
|
* |
54
|
|
|
* This challenge gets sent to the recipient whose information can be found in the SendSmsChallengeCommand. |
55
|
|
|
* This method will return a boolean which indicates if the challenge was sent successfully. |
56
|
|
|
* |
57
|
|
|
* When the MaximumOtpRequestsCount is reached, this method should throw the TooManyChallengesRequestedException |
58
|
|
|
* |
59
|
|
|
* @param SendSmsChallengeCommand $command |
60
|
|
|
* @return bool |
61
|
|
|
*/ |
62
|
|
|
public function sendChallenge(SendSmsChallengeCommand $command); |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Verify the SMS OTP |
66
|
|
|
* |
67
|
|
|
* Proving possession by verifying the OTP, the recipient received and typed in a web form, matches the OTP that was |
68
|
|
|
* sent. Various results can be returned in the form of a ProofOfPossessionResult. |
69
|
|
|
* |
70
|
|
|
* @param VerifyPossessionOfPhoneCommand $challengeCommand |
|
|
|
|
71
|
|
|
* @return OtpVerification |
72
|
|
|
*/ |
73
|
|
|
public function verifyPossession(VerifyPossessionOfPhoneCommand $command); |
74
|
|
|
} |
75
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function. It has, however, found a similar but not annotated parameter which might be a good fit.
Consider the following example. The parameter
$ireland
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was changed, but the annotation was not.