/** * Authenticates a provided access token * * @param AccessControlEvent $event * @return \Parrot\API\Problem\Response\ProblemResponse */ public function __invoke(AccessControlEvent $event) { // Ensure we clear out any previously known Identity $event->getAuthenticationService()->clearIdentity(); // Attempt to Authenticate $result = $event->getAuthenticationService()->getAdapter()->authenticate(); if ($result instanceof Result) { $event->setAuthenticationResult($result); } return $result; }