2323use SimpleSAML \SAML2 \Exception \Protocol \NoSupportedIDPException ;
2424use SimpleSAML \SAML2 \Exception \Protocol \ProtocolViolationException ;
2525use SimpleSAML \SAML2 \Exception \Protocol \ProxyCountExceededException ;
26- use SimpleSAML \SAML2 \XML \Comparison ;
2726use SimpleSAML \SAML2 \XML \md \ContactPerson ;
2827use SimpleSAML \SAML2 \XML \saml \AuthnContextClassRef ;
2928use SimpleSAML \SAML2 \XML \saml \NameID ;
29+ use SimpleSAML \SAML2 \XML \samlp \AuthnContextComparisonTypeEnum ;
3030use SimpleSAML \SAML2 \XML \samlp \Extensions ;
3131use SimpleSAML \SAML2 \XML \samlp \IDPEntry ;
3232use SimpleSAML \SAML2 \XML \samlp \IDPList ;
4141use Symfony \Component \HttpFoundation \Request ;
4242use Symfony \Component \HttpFoundation \Response ;
4343
44+ use function array_column ;
4445use function array_intersect ;
4546use function array_key_exists ;
4647use function array_keys ;
@@ -563,17 +564,16 @@ private function startSSO2(Configuration $idpMetadata, array $state): Response
563564 }
564565
565566 if ($ accr !== null ) {
566- $ comp = Comparison:: EXACT ;
567+ $ comp = AuthnContextComparisonTypeEnum::Exact ;
567568 if ($ idpMetadata ->getOptionalString ('AuthnContextComparison ' , null ) !== null ) {
568569 $ comp = $ idpMetadata ->getString ('AuthnContextComparison ' );
569570 } elseif (
570571 isset ($ state ['saml:AuthnContextComparison ' ])
571- && in_array ($ state ['saml:AuthnContextComparison ' ], [
572- Comparison::EXACT ,
573- Comparison::MINIMUM ,
574- Comparison::MAXIMUM ,
575- Comparison::BETTER ,
576- ], true )
572+ && in_array (
573+ $ state ['saml:AuthnContextComparison ' ],
574+ array_column (AuthnContextComparisonTypeEnum::cases (), 'value ' ),
575+ true ,
576+ )
577577 ) {
578578 $ comp = $ state ['saml:AuthnContextComparison ' ];
579579 }
@@ -588,12 +588,7 @@ private function startSSO2(Configuration $idpMetadata, array $state): Response
588588 isset ($ state ['saml:RequestedAuthnContext ' ]['Comparison ' ])
589589 && in_array (
590590 $ state ['saml:RequestedAuthnContext ' ]['Comparison ' ],
591- [
592- Comparison::EXACT ,
593- Comparison::MINIMUM ,
594- Comparison::MAXIMUM ,
595- Comparison::BETTER ,
596- ],
591+ array_column (AuthnContextComparisonTypeEnum::cases (), 'value ' ),
597592 true ,
598593 )
599594 ) {
@@ -990,7 +985,7 @@ public function reauthenticate(array &$state): void
990985 if (
991986 $ this ->passAuthnContextClassRef
992987 && isset ($ state ['saml:RequestedAuthnContext ' ])
993- && $ state ['saml:RequestedAuthnContext ' ]['Comparison ' ] === Comparison:: EXACT
988+ && $ state ['saml:RequestedAuthnContext ' ]['Comparison ' ] === AuthnContextComparisonTypeEnum::Exact
994989 && isset ($ data ['saml:sp:AuthnContext ' ])
995990 && $ state ['saml:RequestedAuthnContext ' ]['AuthnContextClassRef ' ][0 ] !== $ data ['saml:sp:AuthnContext ' ]
996991 ) {
0 commit comments