/** * Called by login() to acquire the username and password strings for * authentication. This method does no validation of either. * * @return array Array with name and password, e. g. array(0 => $name, 1 => $password) * @throws \AppserverIo\Appserver\Psr\Security\Auth\Login\LoginException Is thrown if name and password can't be loaded */ public function getUsernameAndPassword() { // create and initialize an ArrayList for the callback handlers $list = new ArrayList(); $list->add($nameCallback = new NameCallback()); $list->add($passwordCallback = new PasswordCallback()); // handle the callbacks $this->callbackHandler->handle($list); // return an array with the username and callback return array($nameCallback->getName(), $passwordCallback->getPassword()); }
/** * Test if the callback password setter/getter works as expected. * * @return void */ public function testSetGetPassword() { $this->passwordCallback->setPassword($password = new String(__CLASS__)); $this->assertSame($password, $this->passwordCallback->getPassword()); }