title: PDF generation process cannot load images after adding security check (cookies not passing?)
body: <p>I recently added a security check in my Routes.php file to ensure that only people who should be able to access images can access those images. </p>
  
  <p>It works as expected for user interaction, but now when I generate PDFs it seems that the process which gets the image is not allowed access and therefore the image cannot load in the PDF. </p>
  
  <p><strong>Here is how the image is accessed in the Blade file for the PDF:</strong></p>
  
  <pre><code>&lt;img src="{{ URL::to('image/person/signature',$person-&gt;person_token) }} "&gt;
  </code></pre>
  
  <p>I am accessing it through the Facade (<code>URL</code>), but for some reason the session cookie does not appear to be passed in this request, hence why it fails the security check.</p>
  
  <p><strong>Here is the security check:</strong></p>
  
  <pre><code>Route::get('image/person/signature/{authToken}',function($authToken){
     // This permission checking should actually probably be in the filters file
     $loggedUser = Auth::user();
  
      $person = Person::getByAuthToken($authToken);
      if ($person instanceOf Person){
         // PDF is getting shut out here
         if($loggedUser-&gt;company_id == $person-&gt;company_id || $loggedUser-&gt;isAdmin()) {
             // Processing goes here 
         } else{
             die('You are not authorized to perform this function. Your IP address has been logged.');
         }
       } else {
           die('You are not authorized to perform this function. Your IP address has been logged.');
       }
  });
  </code></pre>
  
  <p>I also tried adding the following conditions to the security check to allow the process access which did not work:</p>
  
  <ul>
  <li><code>$loggedUser instanceOf PDF</code> </li>
  <li><code>$loggedUser instanceOf ServiceProvider</code></li>
  <li><code>Auth::check()</code></li>
  </ul>
  
  <p>The fact that <code>Auth::check()</code> didn't work is suspicious and would indicate that cookie/session information is not being passed.. </p>
  
  <p>I somehow doubt changing any of the settings in DOMPDF will help with this, since it's simply being blocked by the security check. Here is the actual tool I am using for <a href="https://github.com/barryvdh/laravel-dompdf/tree/0.4" rel="nofollow">DOMPDF / Laravel integration</a>. DomPDF is registered as a Service Provider in my app under the Facade of <code>PDF</code>.</p>
  
  <p>Remember, this is certainly not a path issue because it was working before I implemented this security check. All of the questions related to this on SO seem to stem from that. </p>
  
  <p>How can I allow the PDF process to access the image, without wacky workarounds? </p>