Skip to content

Commit ea70b5d

Browse files
committed
Repair the IdP a little bit
1 parent 21eba32 commit ea70b5d

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

modules/saml/src/IdP/SAML2.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use SimpleSAML\SAML2\Exception\ArrayValidationException;
2121
use SimpleSAML\SAML2\XML\md\ContactPerson;
2222
use SimpleSAML\SAML2\XML\saml\{Assertion, EncryptedAssertion}; // Assertions
23-
use SimpleSAML\SAML2\XML\saml\{AttributeValue, Audience, Issuer, NameID, SubjectConfirmation, SubjectConfirmationData};
23+
use SimpleSAML\SAML2\XML\saml\{AttributeValue, Audience, Issuer, NameID, Subject, SubjectConfirmation, SubjectConfirmationData};
2424
use SimpleSAML\SAML2\XML\saml\{AuthenticatingAuthority, AuthnContext, AuthnContextClassRef}; // AuthnContext
2525
use SimpleSAML\SAML2\XML\samlp\{AuthnRequest, LogoutRequest, LogoutResponse, Response as SAML2_Response}; // Messages
2626
use SimpleSAML\SAML2\XML\samlp\{Status, StatusCode, StatusMessage}; // Status
@@ -1188,7 +1188,11 @@ private static function buildAssertion(
11881188
Format: C::NAMEID_ENTITY,
11891189
);
11901190

1191-
$a = new Assertion($issuer, new \DateTimeImmutable('now', new \DateTimeZone('Z')));
1191+
$nameId = self::generateNameId($idpMetadata, $spMetadata, $state);
1192+
$state['saml:idp:NameID'] = $nameId;
1193+
$subject = new Subject($nameId);
1194+
1195+
$a = new Assertion($issuer, new \DateTimeImmutable('now', new \DateTimeZone('Z')), null, $subject);
11921196
if ($signAssertion) {
11931197
Message::addSign($idpMetadata, $spMetadata, $a);
11941198
}
@@ -1314,10 +1318,6 @@ private static function buildAssertion(
13141318
$a->setAttributes($attributes);
13151319
}
13161320

1317-
$nameId = self::generateNameId($idpMetadata, $spMetadata, $state);
1318-
$state['saml:idp:NameID'] = $nameId;
1319-
$a->setNameId($nameId);
1320-
13211321
$encryptNameId = $spMetadata->getOptionalBoolean('nameid.encryption', null);
13221322
if ($encryptNameId === null) {
13231323
$encryptNameId = $idpMetadata->getOptionalBoolean('nameid.encryption', false);

0 commit comments

Comments
 (0)