@@ -19,24 +19,26 @@ public static function insertLogin(&$request, &$date)
1919 $ statisticsTableName = $ databaseConnector ->getStatisticsTableName ();
2020 $ identityProvidersMapTableName = $ databaseConnector ->getIdentityProvidersMapTableName ();
2121 $ serviceProvidersMapTableName = $ databaseConnector ->getServiceProvidersMapTableName ();
22+
23+ if (!in_array ($ databaseConnector ->getMode (), ['PROXY ' , 'IDP ' , 'SP ' ])) {
24+ throw new Exception ('Unknown mode is set. Mode has to be one of the following: PROXY, IDP, SP. ' );
25+ }
26+
27+ if ($ databaseConnector ->getMode () !== 'IDP ' ) {
28+ $ idpName = $ request ['Attributes ' ]['sourceIdPName ' ][0 ];
29+ $ idpEntityID = $ request ['saml:sp:IdP ' ];
30+ }
31+ if ($ databaseConnector ->getMode () !== 'SP ' ) {
32+ $ spEntityId = $ request ['Destination ' ]['entityid ' ];
33+ $ spName = $ request ['Destination ' ]['name ' ]['en ' ];
34+ }
2235
2336 if ($ databaseConnector ->getMode () === 'IDP ' ) {
2437 $ idpName = $ databaseConnector ->getIdpName ();
2538 $ idpEntityID = $ databaseConnector ->getIdpEntityId ();
26- $ spEntityId = $ request ['Destination ' ]['entityid ' ];
27- $ spName = $ request ['Destination ' ]['name ' ]['en ' ];
2839 } elseif ($ databaseConnector ->getMode () === 'SP ' ) {
29- $ idpName = $ request ['Attributes ' ]['sourceIdPName ' ][0 ];
30- $ idpEntityID = $ request ['saml:sp:IdP ' ];
3140 $ spEntityId = $ databaseConnector ->getSpEntityId ();
3241 $ spName = $ databaseConnector ->getSpName ();
33- } elseif ($ databaseConnector ->getMode () === 'PROXY ' ) {
34- $ idpName = $ request ['Attributes ' ]['sourceIdPName ' ][0 ];
35- $ idpEntityID = $ request ['saml:sp:IdP ' ];
36- $ spEntityId = $ request ['Destination ' ]['entityid ' ];
37- $ spName = $ request ['Destination ' ]['name ' ]['en ' ];
38- } else {
39- throw new Exception ('Unknown mode is set. Mode has to be one of the following: PROXY, IDP, SP. ' );
4042 }
4143
4244 $ year = $ date ->format ('Y ' );
0 commit comments