예제 #1
0
 /**
  * @param LoginCommand $command
  * @return string
  */
 public function handleLoginCommand(LoginCommand $command)
 {
     if ($command->getUsername() == "admin" && $command->getPassword() == "singo") {
         /**
          * notify all AfterLoginEvent subscriber
          */
         $this->dispatcher->dispatch(AfterLoginEvent::EVENT, new AfterLoginEvent($command->getUsername()));
         return $this->encoder->encode(["name" => $command->getUsername()]);
     }
     throw new InvalidUsernamePasswordException("invalid username or password");
 }
예제 #2
0
 /**
  * @param $username
  * @return string
  */
 private function signToken($username)
 {
     return $this->jwt_encoder->encode(["name" => $username]);
 }