title: How to redirect an unauthorized user to the 403 page
body: <p>I am using ZendFramework2 with zfc-user and <code>ZfcRbac</code> for authorization and access control. I have setup everything to work with database managed role. Now when a user navigate to an un-authorized page, I am getting the error page <code>You are not authorized to access this resource</code> which is thrown by <code>ZfcRbac</code></p>
  
  <p>Actually I have configured in my <code>zfc-rbac.global.php</code> to redirect to the 403 page. my settings are below.</p>
  
  <pre><code>ZfcRbac\Exception\UnauthorizedException
  </code></pre>
  
  <p>--</p>
  
  <pre><code>'unauthorized_strategy' =&gt; [
       'template' =&gt; 'error/403'
  ],
  </code></pre>
  
  <p>How do I send the user to 403 page?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The right answer is to attach the <code>UnauthorizedStrategy</code> in the onBootstrap</p>
  
  <pre><code>$t = $e-&gt;getTarget();
  $t-&gt;getEventManager()-&gt;attach(
      $t-&gt;getServiceManager()-&gt;get('\ZfcRbac\View\Strategy\UnauthorizedStrategy')
  );
  </code></pre>