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));
 }
Example #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);
 }