private function checkRequestObject(AuthnRequest $request, $id, $time) { $this->assertEquals($id, $request->getID()); $this->assertEquals('2.0', $request->getVersion()); $this->assertEquals($this->destination, $request->getDestination()); $this->assertEquals($this->ascURL, $request->getAssertionConsumerServiceURL()); $this->assertEquals($this->protocolBinding, $request->getProtocolBinding()); $this->assertEquals($time, $request->getIssueInstant()); $this->assertEquals($this->issuer, $request->getIssuer()); $this->assertEquals($this->nameIDPolicyFormat, $request->getNameIdPolicyFormat()); $this->assertTrue($request->getNameIdPolicyAllowCreate()); }
/** * @return AuthnRequest */ public function build() { $result = new AuthnRequest(); $edSP = $this->getEdSP(); $result->setID(Helper::generateID()); $result->setDestination($this->getDestination()); $result->setIssueInstant(time()); $asc = $this->getAssertionConsumerService(); $result->setAssertionConsumerServiceURL($asc->getLocation()); $result->setProtocolBinding($asc->getBinding()); $result->setIssuer($edSP->getEntityID()); if ($this->spMeta->getNameIdFormat()) { $result->setNameIdPolicyFormat($this->spMeta->getNameIdFormat()); } $result->setSignature($this->signature); return $result; }
protected function checkRequest(AuthnRequest $request, $id, $time) { $this->assertEquals($id, $request->getID()); $this->assertEquals('2.0', $request->getVersion()); $this->assertEquals($this->destination, $request->getDestination()); $this->assertEquals($this->ascURL, $request->getAssertionConsumerServiceURL()); $this->assertEquals($this->protocolBinding, $request->getProtocolBinding()); $this->assertEquals($time, $request->getIssueInstant()); $this->assertEquals($this->issuer, $request->getIssuer()); $this->assertEquals($this->nameIDPolicyFormat, $request->getNameIdPolicyFormat()); $this->assertTrue($request->getNameIdPolicyAllowCreate()); /** @var SignatureValidatorInterface $signature */ $signature = $request->getSignature(); $this->assertNotNull($signature); $this->assertTrue($signature instanceof SignatureValidatorInterface); $certificate = new X509Certificate(); $certificate->loadFromFile(__DIR__ . '/../../../../../resources/sample/Certificate/saml.crt'); $key = KeyHelper::createPublicKey($certificate); $signature->validate($key); }