|
20 | 20 | use SimpleSAML\SAML2\Exception\ArrayValidationException; |
21 | 21 | use SimpleSAML\SAML2\XML\md\ContactPerson; |
22 | 22 | 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}; |
24 | 24 | use SimpleSAML\SAML2\XML\saml\{AuthenticatingAuthority, AuthnContext, AuthnContextClassRef}; // AuthnContext |
25 | 25 | use SimpleSAML\SAML2\XML\samlp\{AuthnRequest, LogoutRequest, LogoutResponse, Response as SAML2_Response}; // Messages |
26 | 26 | use SimpleSAML\SAML2\XML\samlp\{Status, StatusCode, StatusMessage}; // Status |
@@ -1188,7 +1188,11 @@ private static function buildAssertion( |
1188 | 1188 | Format: C::NAMEID_ENTITY, |
1189 | 1189 | ); |
1190 | 1190 |
|
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); |
1192 | 1196 | if ($signAssertion) { |
1193 | 1197 | Message::addSign($idpMetadata, $spMetadata, $a); |
1194 | 1198 | } |
@@ -1314,10 +1318,6 @@ private static function buildAssertion( |
1314 | 1318 | $a->setAttributes($attributes); |
1315 | 1319 | } |
1316 | 1320 |
|
1317 | | - $nameId = self::generateNameId($idpMetadata, $spMetadata, $state); |
1318 | | - $state['saml:idp:NameID'] = $nameId; |
1319 | | - $a->setNameId($nameId); |
1320 | | - |
1321 | 1321 | $encryptNameId = $spMetadata->getOptionalBoolean('nameid.encryption', null); |
1322 | 1322 | if ($encryptNameId === null) { |
1323 | 1323 | $encryptNameId = $idpMetadata->getOptionalBoolean('nameid.encryption', false); |
|
0 commit comments