/**
  * @param SsoState $ssoState
  *
  * @return void
  */
 public function set(SsoState $ssoState)
 {
     $ssoState->setLocalSessionId($this->session->getId());
     $this->session->set($this->key, $ssoState);
 }
Exemple #2
0
 public function test_serialization()
 {
     $state = new SsoState();
     $state->setLocalSessionId('local-id');
     $state->getParameters()->add(['a' => 'aaa', 'b' => 2, 'c' => [1, 2, 3]]);
     $state->addSsoSession($session1 = new SsoSessionState());
     $session1->setIdpEntityId($idp1 = 'idp1');
     $state->addSsoSession($session2 = new SsoSessionState());
     $session2->setIdpEntityId($idp2 = 'idp2');
     /** @var SsoState $other */
     $other = unserialize(serialize($state));
     $this->assertEquals($state->getLocalSessionId(), $other->getLocalSessionId());
     $this->assertInstanceOf(ParameterBag::class, $other->getParameters());
     $this->assertEquals($state->getParameters()->all(), $other->getParameters()->all());
     $this->assertEquals(count($state->getSsoSessions()), count($other->getSsoSessions()));
 }