2727 */
2828class SFO extends Auth \ProcessingFilter
2929{
30- /** @var array */
31- private array $ metadata ;
30+ /** @var \SimpleSAML\Configuration */
31+ private Configuration $ metadata ;
3232
33- /** @var array */
34- private array $ idpMetadata ;
33+ /** @var \SimpleSAML\Configuration */
34+ private Configuration $ idpMetadata ;
3535
3636 /** @var string */
3737 private string $ subjectidattribute ;
@@ -51,7 +51,7 @@ public function __construct(array $config, $reserved)
5151 parent ::__construct ($ config , $ reserved );
5252
5353 $ this ->subjectidattribute = $ config ['subjectattribute ' ];
54- if (isset ($ config ['skipentities ' ]) ) {
54+ if (isset ($ config ['skipentities ' ])) {
5555 $ this ->skipentities = $ config ['skipentities ' ];
5656 }
5757
@@ -69,7 +69,7 @@ public function __construct(array $config, $reserved)
6969 */
7070 public function process (array &$ state ): void
7171 {
72- foreach ($ this ->skipentities as $ skip ) {
72+ foreach ($ this ->skipentities as $ skip ) {
7373 if ($ skip === $ state ['SPMetadata ' ]['entityid ' ] || in_array ($ skip , $ state ['saml:RequesterID ' ], true )) {
7474 Logger::info ('SFO - skipping SFO for entity ' . var_export ($ skip , true ));
7575 return ;
@@ -80,13 +80,16 @@ public function process(array &$state): void
8080 $ state ['sfo:idp:entityid ' ] = $ this ->idpMetadata ->getString ('entityid ' );
8181 $ samlstateid = Auth \State::saveState ($ state , 'stepupsfo:pre ' );
8282
83- if (empty ($ state ['Attributes ' ][$ this ->subjectidattribute ]) ) {
83+ if (empty ($ state ['Attributes ' ][$ this ->subjectidattribute ])) {
8484 throw new Exception ("Subjectid " . $ this ->subjectidattribute . " not found in attributes. " );
8585 }
8686
8787 $ subjectid = $ state ['Attributes ' ][$ this ->subjectidattribute ][0 ];
88- if (substr ($ subjectid ,0 ,18 ) !== 'urn:collab:person: ' ) {
89- throw new Exception ("Subjectid " . var_export ($ subjectid ,true ) . " does not start with urn:collab:person: " );
88+ if (substr ($ subjectid , 0 , 18 ) !== 'urn:collab:person: ' ) {
89+ throw new Exception (sprintf (
90+ "Subjectid %s does not start with urn:collab:person: " ,
91+ var_export ($ subjectid , true )
92+ ));
9093 }
9194
9295 $ nameid = new NameID ();
@@ -138,12 +141,17 @@ private function startSFO(Configuration $idpMetadata, NameID $nameid, $relay): v
138141 $ ar ->setNameId ($ nameid );
139142 $ ar ->setRelayState ($ relay );
140143
141- Logger::debug ('Sending SAML 2 SFO AuthnRequest for ' . $ nameid ->getValue () . ' to ' .
142- var_export ($ idpMetadata ->getString ('entityid ' ), true ). ' with id ' . $ ar ->getId ());
144+ Logger::debug (sprintf (
145+ 'Sending SAML 2 SFO AuthnRequest for %s to %s with id %s ' ,
146+ $ nameid ->getValue (),
147+ var_export ($ idpMetadata ->getString ('entityid ' ), true ),
148+ $ ar ->getId ()
149+ ));
143150
144- $ dst = $ idpMetadata ->getEndpointPrioritizedByBinding ('SingleSignOnService ' ,
145- [C::BINDING_HTTP_REDIRECT ]
146- );
151+ $ dst = $ idpMetadata ->getEndpointPrioritizedByBinding (
152+ 'SingleSignOnService ' ,
153+ [C::BINDING_HTTP_REDIRECT ]
154+ );
147155
148156 $ ar ->setDestination ($ dst ['Location ' ]);
149157
0 commit comments