app/Containers/Authentication/Tasks/ApiAuthenticationTask.php 1 location
|
@@ 69-81 (lines=13) @@
|
| 66 |
|
* |
| 67 |
|
* @return bool |
| 68 |
|
*/ |
| 69 |
|
public function logout($authorizationHeader) |
| 70 |
|
{ |
| 71 |
|
// remove the `Bearer` string from the header and keep only the token |
| 72 |
|
$token = str_replace('Bearer', '', $authorizationHeader); |
| 73 |
|
|
| 74 |
|
$ok = $this->jwtAuthAdapter->invalidate($token); |
| 75 |
|
|
| 76 |
|
if (!$ok) { |
| 77 |
|
throw new MissingTokenException(); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
return true; |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
/** |
| 84 |
|
* login/authenticate user and return its token. |
app/Containers/Authentication/Tasks/ApiLogoutTask.php 1 location
|
@@ 38-50 (lines=13) @@
|
| 35 |
|
* |
| 36 |
|
* @return bool |
| 37 |
|
*/ |
| 38 |
|
public function run($authorizationHeader) |
| 39 |
|
{ |
| 40 |
|
// remove the `Bearer` string from the header and keep only the token |
| 41 |
|
$token = str_replace('Bearer', '', $authorizationHeader); |
| 42 |
|
|
| 43 |
|
$ok = $this->jwtAuthAdapter->invalidate($token); |
| 44 |
|
|
| 45 |
|
if (!$ok) { |
| 46 |
|
throw new MissingTokenException(); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
return true; |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
} |
| 53 |
|
|