} */ private array $realms; /** */ public function __construct( array $realms ) { // parent::__construct(); $this->realms = $realms; $this->setRealm('davina'); } /** */ protected function validateUserPass( /*string */$identifier, /*string */$password )/* : bool*/ { $parts = \explode('-', $identifier, 2); $realm_name = $parts[0]; $credentials = [ 'username' => ( (\count($parts) >= 2) ? $parts[1] : null ), 'password' => $password, ]; if (! \array_key_exists($realm_name, $this->realms)) { return false; } else { $realm = $this->realms[$realm_name]; if (! $realm->auth->check($credentials)) { return false; } else { /** * @todo check for security */ \davina\set_parameters( \array_merge( $realm->auth->determine_parameters($credentials), [ 'realm_name' => $realm_name, ] ) ); try { $data = $realm->source->read(); return ($data !== null); } catch (\Throwable $throwable) { return false; } } } } } ?>