@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use app\forms\Activation; |
6 | 6 | use yrc\rest\Action as RestAction; |
7 | - |
|
8 | 7 | use yii\web\HttpException; |
9 | 8 | use Yii; |
10 | 9 |
@@ -5,7 +5,6 @@ |
||
5 | 5 | use app\forms\Login; |
6 | 6 | use app\models\Token; |
7 | 7 | use yrc\rest\Action as RestAction; |
8 | - |
|
9 | 8 | use yii\web\UnauthorizedHttpException; |
10 | 9 | use Yii; |
11 | 10 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Deauthenticates a user |
41 | - * @return mixed |
|
41 | + * @return boolean |
|
42 | 42 | */ |
43 | 43 | public function delete($params) |
44 | 44 | { |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use app\models\User; |
6 | 6 | use yrc\rest\Action as RestAction; |
7 | - |
|
8 | 7 | use yii\web\HttpException; |
9 | 8 | use Yii; |
10 | 9 |
@@ -129,9 +129,9 @@ |
||
129 | 129 | |
130 | 130 | // Calculate the signature string |
131 | 131 | $signatureString = hash('sha256', $body) . "\n" . |
132 | - $request->method . "+" . $request->getUrl() . "\n" . |
|
133 | - $request->getHeaders()->get(self::DATE_HEADER) . "\n" . |
|
134 | - \base64_encode($salt); |
|
132 | + $request->method . "+" . $request->getUrl() . "\n" . |
|
133 | + $request->getHeaders()->get(self::DATE_HEADER) . "\n" . |
|
134 | + \base64_encode($salt); |
|
135 | 135 | |
136 | 136 | // Calculate the HMAC |
137 | 137 | $selfHMAC = \base64_encode(\hash_hmac('sha256', $signatureString, $hkdf, true)); |
@@ -92,7 +92,7 @@ |
||
92 | 92 | private function isHMACSignatureValid($accessToken, $ikm, $salt, $request, $hmac = null) |
93 | 93 | { |
94 | 94 | static $selfHMAC = null; |
95 | - static $hkdf = null; |
|
95 | + static $hkdf = null; |
|
96 | 96 | |
97 | 97 | // Null check the HMAC string |
98 | 98 | if (empty($hmac) || $hmac === null) { |
@@ -87,6 +87,7 @@ discard block |
||
87 | 87 | * @param string $accessToken |
88 | 88 | * @param string $salt |
89 | 89 | * @param \yii\web\request $request |
90 | + * @param string $ikm |
|
90 | 91 | * @return bool |
91 | 92 | */ |
92 | 93 | private function isHMACSignatureValid($accessToken, $ikm, $salt, $request, $hmac = null) |
@@ -152,7 +153,7 @@ discard block |
||
152 | 153 | |
153 | 154 | /** |
154 | 155 | * Gets the datetime drift that has occured since the request was sent |
155 | - * @param yii\web\Request $request |
|
156 | + * @param \yii\web\Request $request |
|
156 | 157 | * @return int |
157 | 158 | */ |
158 | 159 | private function getTimeDrift($request) |
@@ -3,10 +3,7 @@ |
||
3 | 3 | namespace yrc\filters\auth; |
4 | 4 | |
5 | 5 | use app\models\Token; |
6 | - |
|
7 | -use yii\helpers\Json; |
|
8 | 6 | use yii\filters\auth\AuthMethod; |
9 | - |
|
10 | 7 | use Yii; |
11 | 8 | |
12 | 9 | /** |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace yrc\api\forms; |
4 | 4 | |
5 | 5 | use app\models\Token; |
6 | -use yii\web\UnauthorizedHttpException; |
|
7 | 6 | use Yii; |
8 | 7 | |
9 | 8 | /** |
@@ -2,7 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace yrc\api\forms; |
4 | 4 | |
5 | -use Base32\Base32; |
|
6 | 5 | use Yii; |
7 | 6 | |
8 | 7 | /** |
@@ -4,8 +4,6 @@ |
||
4 | 4 | |
5 | 5 | use app\forms\ResetPassword; |
6 | 6 | use yrc\rest\Action as RestAction; |
7 | -use yrc\api\models\Code; |
|
8 | - |
|
9 | 7 | use yii\web\HttpException; |
10 | 8 | use Yii; |
11 | 9 |
@@ -2,9 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace yrc\api\forms; |
4 | 4 | |
5 | -use Base32\Base32; |
|
6 | 5 | use Yii; |
7 | - |
|
8 | 6 | use yrc\api\models\Code; |
9 | 7 | |
10 | 8 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | |
30 | 30 | // Pull the exception |
31 | 31 | $exception = Yii::$app->errorHandler->exception; |
32 | - if ($exception && is_subclass_of($exception, 'yii\web\HttpException') || get_class($exception) === 'yii\web\HttpException' ) { |
|
32 | + if ($exception && is_subclass_of($exception, 'yii\web\HttpException') || get_class($exception) === 'yii\web\HttpException') { |
|
33 | 33 | $copy = $response->data; |
34 | 34 | $response->data = null; |
35 | 35 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $response->data['status'] = $status; |
65 | 65 | |
66 | 66 | if ($response->data['data'] === [] || $response->data['data'] === null) { |
67 | - $response->data['data'] = null; |
|
67 | + $response->data['data'] = null; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 |