@@ -53,14 +53,14 @@ |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | switch ($_GET['token']) { |
56 | - case "SELF-REGISTER": |
|
57 | - $token = "SELF-REGISTER"; |
|
58 | - $checkval = \core\UserManagement::TOKENSTATUS_OK_NEW; |
|
59 | - $federation = CONFIG_CONFASSISTANT['CONSORTIUM']['selfservice_registration']; |
|
60 | - break; |
|
61 | - default: |
|
62 | - $token = $validator->token(filter_input(INPUT_GET,'token',FILTER_SANITIZE_STRING)); |
|
63 | - $checkval = $usermgmt->checkTokenValidity($token); |
|
56 | + case "SELF-REGISTER": |
|
57 | + $token = "SELF-REGISTER"; |
|
58 | + $checkval = \core\UserManagement::TOKENSTATUS_OK_NEW; |
|
59 | + $federation = CONFIG_CONFASSISTANT['CONSORTIUM']['selfservice_registration']; |
|
60 | + break; |
|
61 | + default: |
|
62 | + $token = $validator->token(filter_input(INPUT_GET,'token',FILTER_SANITIZE_STRING)); |
|
63 | + $checkval = $usermgmt->checkTokenValidity($token); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if ($checkval < 0) { |
@@ -205,7 +205,7 @@ |
||
205 | 205 | * @param int $rowid the HTML field base name of the option to be displayed |
206 | 206 | * @param string $optionName the name of the option to display |
207 | 207 | * @param string $optionValue the value of the option to display |
208 | - * @param mixed $optionLang the language of the option to display |
|
208 | + * @param null|string $optionLang the language of the option to display |
|
209 | 209 | * @return string HTML code |
210 | 210 | * @throws Exception |
211 | 211 | */ |
@@ -96,6 +96,12 @@ |
||
96 | 96 | */ |
97 | 97 | protected $frontendHandle; |
98 | 98 | |
99 | + /** |
|
100 | + * @param integer $idpIdentifier |
|
101 | + * @param string $deviceId |
|
102 | + * @param string $area |
|
103 | + * @param string $lang |
|
104 | + */ |
|
99 | 105 | protected function saveDownloadDetails($idpIdentifier, $profileId, $deviceId, $area, $lang, $eapType) { |
100 | 106 | if (CONFIG['PATHS']['logdir']) { |
101 | 107 | $file = fopen(CONFIG['PATHS']['logdir'] . "/download_details.log", "a"); |
@@ -216,7 +216,7 @@ |
||
216 | 216 | * realm (and indirectly that of the links and statuses of involved proxies |
217 | 217 | * and returns a judgment whether external Monitoring API tests are warranted |
218 | 218 | * or not |
219 | - * @return boolean TRUE if external tests have to be run |
|
219 | + * @return boolean|null TRUE if external tests have to be run |
|
220 | 220 | */ |
221 | 221 | private function CATInternalTests() { |
222 | 222 | // we are expecting to get a REJECT from all runs, because that means the packet got through to the IdP. |
@@ -77,84 +77,84 @@ |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | switch ($operationMode) { |
80 | - case OPERATION_MODE_EDIT: |
|
81 | - $idp = $validator->IdP($_GET['inst_id']); |
|
82 | - // editing IdPs is done from within the popup. When we're done, send the |
|
83 | - // user back to the popup (append the result of the operation later) |
|
84 | - $redirect_destination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
85 | - $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
86 | - // is the user primary admin of this IdP? |
|
87 | - $is_owner = $idp->isPrimaryOwner($_SESSION['user']); |
|
88 | - // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then. |
|
89 | - $fedadmin = $userObject->isFederationAdmin($idp->federation); |
|
90 | - // check if he is either one, if not, complain |
|
91 | - if (!$is_owner && !$fedadmin) { |
|
92 | - echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclature_fed, $uiElements->nomenclature_fed, $uiElements->nomenclature_inst) . "</p>"; |
|
93 | - exit(1); |
|
94 | - } |
|
80 | + case OPERATION_MODE_EDIT: |
|
81 | + $idp = $validator->IdP($_GET['inst_id']); |
|
82 | + // editing IdPs is done from within the popup. When we're done, send the |
|
83 | + // user back to the popup (append the result of the operation later) |
|
84 | + $redirect_destination = "manageAdmins.inc.php?inst_id=" . $idp->identifier . "&"; |
|
85 | + $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
86 | + // is the user primary admin of this IdP? |
|
87 | + $is_owner = $idp->isPrimaryOwner($_SESSION['user']); |
|
88 | + // check if he is (also) federation admin for the federation this IdP is in. His invitations have more blessing then. |
|
89 | + $fedadmin = $userObject->isFederationAdmin($idp->federation); |
|
90 | + // check if he is either one, if not, complain |
|
91 | + if (!$is_owner && !$fedadmin) { |
|
92 | + echo "<p>" . sprintf(_("Something's wrong... you are a %s admin, but not for the %s the requested %s belongs to!"), $uiElements->nomenclature_fed, $uiElements->nomenclature_fed, $uiElements->nomenclature_inst) . "</p>"; |
|
93 | + exit(1); |
|
94 | + } |
|
95 | 95 | |
96 | - $prettyprintname = $idp->name; |
|
97 | - $newtoken = $mgmt->createToken($fedadmin, $mailaddress, $idp); |
|
98 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . $mailaddress); |
|
99 | - $introtext = sprintf(_("a %s of the %s %s \"%s\" has invited you to manage the %s together with him."), $uiElements->nomenclature_fed, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_inst, $prettyprintname, $uiElements->nomenclature_inst) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
100 | - break; |
|
101 | - case OPERATION_MODE_NEWUNLINKED: |
|
102 | - $redirect_destination = "../overview_federation.php?"; |
|
103 | - $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
104 | - // run an input check and conversion of the raw inputs... just in case |
|
105 | - $newinstname = $validator->string($_POST['name']); |
|
106 | - $newcountry = $validator->string($_POST['country']); |
|
107 | - $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
|
108 | - if ($new_idp_authorized_fedadmin !== TRUE) { |
|
109 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!"); |
|
110 | - } |
|
111 | - $federation = $validator->Federation($newcountry); |
|
112 | - $prettyprintname = $newinstname; |
|
113 | - $introtext = sprintf(_("a %s %s has invited you to manage the future %s \"%s\" (%s)."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname, $newcountry) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
114 | - // send the user back to his federation overview page, append the result of the operation later |
|
115 | - // do the token creation magic |
|
116 | - $newtoken = $mgmt->createToken(TRUE, $mailaddress, $newinstname, 0, $newcountry); |
|
117 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . $mailaddress); |
|
118 | - break; |
|
119 | - case OPERATION_MODE_NEWFROMDB: |
|
120 | - $redirect_destination = "../overview_federation.php?"; |
|
121 | - $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
122 | - // a real external DB entry was submitted and all the required parameters are there |
|
123 | - $newexternalid = $validator->string($_POST['externals']); |
|
124 | - $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
|
125 | - $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
|
126 | - if ($new_idp_authorized_fedadmin !== TRUE) { |
|
127 | - throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!"); |
|
128 | - } |
|
129 | - $federation = $validator->Federation($extinfo['country']); |
|
130 | - $newcountry = $extinfo['country']; |
|
131 | - // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list |
|
132 | - $prettyprintname = ""; |
|
133 | - foreach ($extinfo['names'] as $lang => $name) { |
|
134 | - if ($lang == $languageInstance->getLang()) { |
|
135 | - $prettyprintname = $name; |
|
96 | + $prettyprintname = $idp->name; |
|
97 | + $newtoken = $mgmt->createToken($fedadmin, $mailaddress, $idp); |
|
98 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP " . $idp->identifier . " - Token created for " . $mailaddress); |
|
99 | + $introtext = sprintf(_("a %s of the %s %s \"%s\" has invited you to manage the %s together with him."), $uiElements->nomenclature_fed, CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_inst, $prettyprintname, $uiElements->nomenclature_inst) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
100 | + break; |
|
101 | + case OPERATION_MODE_NEWUNLINKED: |
|
102 | + $redirect_destination = "../overview_federation.php?"; |
|
103 | + $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
104 | + // run an input check and conversion of the raw inputs... just in case |
|
105 | + $newinstname = $validator->string($_POST['name']); |
|
106 | + $newcountry = $validator->string($_POST['country']); |
|
107 | + $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($newcountry); |
|
108 | + if ($new_idp_authorized_fedadmin !== TRUE) { |
|
109 | + throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!"); |
|
136 | 110 | } |
137 | - } |
|
138 | - if ($prettyprintname == "" && isset($extinfo['names']['en'])) { |
|
139 | - $prettyprintname = $extinfo['names']['en']; |
|
140 | - } |
|
141 | - if ($prettyprintname == "") { |
|
142 | - foreach ($extinfo['names'] as $name) { |
|
143 | - $prettyprintname = $name; |
|
111 | + $federation = $validator->Federation($newcountry); |
|
112 | + $prettyprintname = $newinstname; |
|
113 | + $introtext = sprintf(_("a %s %s has invited you to manage the future %s \"%s\" (%s)."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname, $newcountry) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
114 | + // send the user back to his federation overview page, append the result of the operation later |
|
115 | + // do the token creation magic |
|
116 | + $newtoken = $mgmt->createToken(TRUE, $mailaddress, $newinstname, 0, $newcountry); |
|
117 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . $mailaddress); |
|
118 | + break; |
|
119 | + case OPERATION_MODE_NEWFROMDB: |
|
120 | + $redirect_destination = "../overview_federation.php?"; |
|
121 | + $mailaddress = abortOnBogusMail($newmailaddress, $redirect_destination); |
|
122 | + // a real external DB entry was submitted and all the required parameters are there |
|
123 | + $newexternalid = $validator->string($_POST['externals']); |
|
124 | + $extinfo = $catInstance->getExternalDBEntityDetails($newexternalid); |
|
125 | + $new_idp_authorized_fedadmin = $userObject->isFederationAdmin($extinfo['country']); |
|
126 | + if ($new_idp_authorized_fedadmin !== TRUE) { |
|
127 | + throw new Exception("Something's wrong... you want to create a new " . $uiElements->nomenclature_inst . ", but are not a " . $uiElements->nomenclature_fed . " admin for the " . $uiElements->nomenclature_fed . " it should be in!"); |
|
144 | 128 | } |
145 | - } |
|
146 | - // fill the rest of the text |
|
147 | - $introtext = sprintf(_("a %s %s has invited you to manage the %s \"%s\"."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
148 | - // do the token creation magic |
|
149 | - $newtoken = $mgmt->createToken(TRUE, $mailaddress, $prettyprintname, $newexternalid); |
|
150 | - $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . $mailaddress); |
|
151 | - break; |
|
152 | - default: // includes OPERATION_MODE_INVALID |
|
153 | - $wrongcontent = print_r($_POST, TRUE); |
|
154 | - echo "<pre>Wrong parameters in POST: |
|
129 | + $federation = $validator->Federation($extinfo['country']); |
|
130 | + $newcountry = $extinfo['country']; |
|
131 | + // see if the inst name is defined in the currently set language; if not, pick its English name; if N/A, pick the last in the list |
|
132 | + $prettyprintname = ""; |
|
133 | + foreach ($extinfo['names'] as $lang => $name) { |
|
134 | + if ($lang == $languageInstance->getLang()) { |
|
135 | + $prettyprintname = $name; |
|
136 | + } |
|
137 | + } |
|
138 | + if ($prettyprintname == "" && isset($extinfo['names']['en'])) { |
|
139 | + $prettyprintname = $extinfo['names']['en']; |
|
140 | + } |
|
141 | + if ($prettyprintname == "") { |
|
142 | + foreach ($extinfo['names'] as $name) { |
|
143 | + $prettyprintname = $name; |
|
144 | + } |
|
145 | + } |
|
146 | + // fill the rest of the text |
|
147 | + $introtext = sprintf(_("a %s %s has invited you to manage the %s \"%s\"."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $uiElements->nomenclature_fed, $uiElements->nomenclature_inst, $prettyprintname) . " " . sprintf(_("This invitation is valid for 24 hours from now, i.e. until %s."), strftime("%x %X", time() + 86400)); |
|
148 | + // do the token creation magic |
|
149 | + $newtoken = $mgmt->createToken(TRUE, $mailaddress, $prettyprintname, $newexternalid); |
|
150 | + $loggerInstance->writeAudit($_SESSION['user'], "NEW", "IdP FUTURE - Token created for " . $mailaddress); |
|
151 | + break; |
|
152 | + default: // includes OPERATION_MODE_INVALID |
|
153 | + $wrongcontent = print_r($_POST, TRUE); |
|
154 | + echo "<pre>Wrong parameters in POST: |
|
155 | 155 | " . htmlspecialchars($wrongcontent) . " |
156 | 156 | </pre>"; |
157 | - exit(1); |
|
157 | + exit(1); |
|
158 | 158 | } |
159 | 159 | // are we on https? |
160 | 160 | $proto = "http://"; |
@@ -254,7 +254,7 @@ |
||
254 | 254 | * create a CSR |
255 | 255 | * |
256 | 256 | * @param resource $privateKey the private key to create the CSR with |
257 | - * @return array with the CSR and some meta info |
|
257 | + * @return integer with the CSR and some meta info |
|
258 | 258 | */ |
259 | 259 | private function generateCsr($privateKey) { |
260 | 260 | // token leads us to the NRO, to set the OU property of the cert |
@@ -131,6 +131,7 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @param string $device |
133 | 133 | * @param AbstractProfile $profile |
134 | + * @param string $generatedFor |
|
134 | 135 | * @return array info about the new installer (mime and link) |
135 | 136 | */ |
136 | 137 | private function generateNewInstaller($device, $profile, $generatedFor, $token, $password) { |
@@ -719,6 +720,7 @@ discard block |
||
719 | 720 | /** |
720 | 721 | * Order active identity providers according to their distance and name |
721 | 722 | * @param array $currentLocation - current location |
723 | + * @param string $country |
|
722 | 724 | * @return array $IdPs - list of arrays ('id', 'name'); |
723 | 725 | */ |
724 | 726 | public function orderIdentityProviders($country, $currentLocation = NULL) { |