17 require_once SQ_PACKAGES_PATH.
'/cms/page_templates/page_asset_builder/page_asset_builder_edit_fns.inc';
40 parent::__construct();
57 $installed = $asset->isSimplesamlphpInstalled();
59 echo
'<span style="color:green;font-weight:bold">Installed</span>';
61 echo
'<span style="color:red;font-weight:bold">Not Installed</span>';
79 $installed = $asset->isSimplesamlphpInstalled();
81 require SQ_TOOL_SIMPLESAMLPHP_PATH.
'/config/authsources.php';
83 foreach ($config as $name => $value) {
84 $options[$name] = $name;
87 if (!$asset->writeAccess(
'attributes')) {
88 echo $options[$asset->attr(
'auth_source')];
90 combo_box($prefix.
'_auth_source', $options, FALSE, $asset->attr(
'auth_source'));
109 if (isset($_POST[$prefix.
'_auth_source'])) {
110 $id = trim($_POST[$prefix.
'_auth_source']);
111 if (empty($id))
return FALSE;
112 $asset->setAttrValue(
'auth_source', $id);
131 if($asset->attr(
'auth_source')) {
132 $url = $asset->getUrl();
133 echo
'<a href="'.$url.
'?showMetadata">'.$url.
'?showMetadata'.
'</a>';
149 $acs_asset = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_TYPE_2,
'saml2_acs', TRUE,
'saml2_assertion_consumer_service',
'major',
'1');
150 $acs_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($acs_asset[
'minorid']);
152 echo ($acs_asset->getUrl());
169 $sls_asset = $GLOBALS[
'SQ_SYSTEM']->am->getLink($asset->id, SQ_LINK_TYPE_2,
'saml2_sls', TRUE,
'saml2_single_logout_service',
'major',
'1');
170 $sls_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($sls_asset[
'minorid']);
172 echo ($sls_asset->getUrl());
191 $redirect_asset = $asset->getRedirectAsset();
192 if ($asset->writeAccess(
'links')) {
193 asset_finder($prefix.
'_redirect_assetid', (is_null($redirect_asset) ? 0 : $redirect_asset->id));
195 if (is_null($redirect_asset)) {
196 echo translate(
'saml_redirect_none_set');
198 echo get_asset_tag_line($redirect_asset->id);
218 if (!isset($_POST[$prefix.
'_redirect_assetid'][
'assetid']) || (isset($asset->_tmp[
'reverting_to_system_version']) && $asset->_tmp[
'reverting_to_system_version'])) {
222 $redirect_assetid = $_POST[$prefix.
'_redirect_assetid'][
'assetid'];
224 if ($redirect_assetid) {
225 $redirect_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($redirect_assetid);
227 $redirect_asset = NULL;
230 return $asset->setRedirectAsset($redirect_asset);
248 if (!$asset->writeAccess(
'attributes')) {
249 parent::paintAssetTypes($asset, $o, $prefix);
251 $user_types = $GLOBALS[
'SQ_SYSTEM']->am->getTypeDescendants(
'user');
253 $options = Array(
'user' =>
'User');
254 foreach ($user_types as $type_code) {
255 $info = $GLOBALS[
'SQ_SYSTEM']->am->getTypeInfo($type_code);
256 if ($info[
'allowed_access'] !=
'system' && $info[
'instantiable']) {
257 $options[$type_code] = $info[
'name'];
260 combo_box($prefix.
'_create_type', $options, FALSE, array_keys($asset->attr(
'create_type')));
281 if (isset($_POST[$prefix.
'_create_type'])) {
282 $type = trim($_POST[$prefix.
'_create_type']);
283 if (empty($type))
return FALSE;
284 $types = Array($type => TRUE);
285 $asset->setAttrValue(
'create_type', $types);
306 $customised_types = $asset->attr(
'create_form_customisations');
307 $wa = $asset->writeAccess(
'attributes');
309 hidden_field($prefix.
'_customise_form_submitted', 1);
310 echo check_box($prefix.
'_customise_form', 1, !empty($customised_types));
312 $fn = !empty($customised_types) ?
'tick' :
'cross';
313 echo
'<img src="'.sq_web_path(
'lib').
'/web/images/'.$fn.
'.gif" />';
331 if ($asset->writeAccess(
'attributes') && isset($_POST[$prefix.
'_customise_form_submitted'])) {
332 $customise = array_get_index($_POST, $prefix.
'_customise_form');
333 $customised_types = $customise ? array_keys($asset->attr(
'create_type')) : Array();
334 return $asset->setAttrValue(
'create_form_customisations', $customised_types);
355 $wa = $asset->writeAccess(
'attributes');
356 $xmldata = isset($_POST[$prefix.
'_parse_metadata']) ? trim($_POST[$prefix.
'_parse_metadata']) :
'';
358 if (!empty($xmldata)) {
360 SimpleSAML_Utilities::validateXMLDocument($xmldata,
'saml-meta');
361 $entities = SimpleSAML_Metadata_SAMLParser::parseDescriptorsString($xmldata);
364 foreach($entities as &$entity) {
366 'saml20-idp-remote' => $entity->getMetadata20IdP(),
372 $output = SimpleSAML_Utilities::transposeArray($entities);
374 catch (Exception $e) {
375 trigger_error($e->getMessage());
378 pre_echo($output[
'saml20-idp-remote']);
382 text_area($prefix.
'_parse_metadata',
'', 100, 5);
403 $use_extensions = $asset->attr(
'use_extensions');
404 return ($use_extensions);
418 $location = $asset->attr(
'saml_userid_location');
419 return ($location ==
'attribute');