Пример #1
0
 public function destroy()
 {
     $payload = $this->getAuthToken();
     $user = $this->driver->validate($payload);
     if (!$user) {
         throw new NotAuthorizedException();
     }
     $this->driver->getProvider()->purge($user);
     $this->events->fire('auth.token.deleted', array($user));
     return Response::json(array('success' => true));
 }
Пример #2
0
 function filter($route, $request)
 {
     $payload = $request->header('X-Auth-Token');
     $userAgent = $request->header('User-Agent');
     if (empty($payload)) {
         $payload = $request->input('auth_token');
     }
     $user = $this->driver->validate($payload, $userAgent);
     if (!$user) {
         throw new NotAuthorizedException();
     }
     $this->events->fire('auth.token.valid', $user);
 }