/**
  * Checks that we have a valid token linked to a valid resource and that the
  * user is authorised to access it
  *
  * Inspects the controller method annotations and if PublicPage is found
  * it checks that we have a token and an optional password giving access to a valid resource.
  * Once that's done, the environment is setup so that our services can find the resources they
  * need.
  *
  * The checks are not performed on "guest" pages and the environment is not setup. Typical
  * guest pages are anonymous error ages
  *
  * @inheritDoc
  */
 public function beforeController($controller, $methodName)
 {
     if ($this->reflector->hasAnnotation('Guest')) {
         return;
     }
     $isPublicPage = $this->reflector->hasAnnotation('PublicPage');
     if ($isPublicPage) {
         $this->validateAndSetTokenBasedEnv();
     } else {
         $this->environment->setStandardEnv();
     }
 }