/** * Authenticate * * @param AbstractAuthenticationProvider $provider Authentication provider * * @return bool * @throws \Rad\Database\Exception */ public function authenticate(AbstractAuthenticationProvider $provider) { if (null === $provider->getRepository()) { $provider->setRepository(new DatabaseRepository(ConnectionManager::get('default'))); } $output = $provider->authenticate(); $this->storage->flush(); if (is_array($output)) { if (null !== $this->userDetails) { $output = $this->userDetails->getDetails($output); } $this->storage->write($output); return true; } return $output; }
/** * Rad\Authentication\Provider\BasicHttpAuthentication constructor * * @param ServerRequest $request */ public function __construct(ServerRequest $request) { if (isset($request->getServerParams()['PHP_AUTH_USER'])) { $this->identity = $request->getServerParams()['PHP_AUTH_USER']; } if (isset($request->getServerParams()['PHP_AUTH_PW'])) { $this->credential = $request->getServerParams()['PHP_AUTH_PW']; } parent::__construct($this->identity, $this->credential); }