<commit_before><?php

require_once('../../_include.php');

require_once('SimpleSAML/Utilities.php');
require_once('SimpleSAML/Session.php');
require_once('SimpleSAML/XML/MetaDataStore.php');
require_once('SimpleSAML/XHTML/Template.php');

session_start();

/* Load simpleSAMLphp, configuration and metadata */
$config = SimpleSAML_Configuration::getInstance();
$metadata = new SimpleSAML_XML_MetaDataStore($config);
$session = SimpleSAML_Session::getInstance();

try {

	$spmeta = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrent();
	$spentityid = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrentEntityID();
	
	if (!$spmeta['assertionConsumerServiceURL']) throw new Exception('The following parameter is not set in your SAML 2.0 SP Hosted metadata: assertionConsumerServiceURL');
	if (!$spmeta['SingleLogOutUrl']) throw new Exception('The following parameter is not set in your SAML 2.0 SP Hosted metadata: SingleLogOutUrl');
	
	$metaxml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EntityDescriptor entityID="' . $spentityid . '" xmlns="urn:oasis:names:tc:SAML:2.0:metadata">

	<SPSSODescriptor 
		AuthnRequestsSigned="false" 
		WantAssertionsSigned="false" 
		protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">

		<SingleLogoutService 
			Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" 
			Location="' . $spmeta['assertionConsumerServiceURL'] . '"/>
		
		<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
		
		<AssertionConsumerService 
			index="0" 
			isDefault="true" 
			Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" 
			Location="' .  $spmeta['SingleLogOutUrl']  . '" />

	</SPSSODescriptor>

</EntityDescriptor>';
	
	
	$et = new SimpleSAML_XHTML_Template($config, 'metadata.php');
	
	$et->data['header'] = 'SAML 2.0 SP Metadata';
	$et->data['metadata'] = htmlentities($metaxml);
	
	$et->show();
	
} catch(Exception $exception) {<commit_msg>I switched two urls in metadata generation<commit_after><?php

require_once('../../_include.php');

require_once('SimpleSAML/Utilities.php');
require_once('SimpleSAML/Session.php');
require_once('SimpleSAML/XML/MetaDataStore.php');
require_once('SimpleSAML/XHTML/Template.php');

session_start();

/* Load simpleSAMLphp, configuration and metadata */
$config = SimpleSAML_Configuration::getInstance();
$metadata = new SimpleSAML_XML_MetaDataStore($config);
$session = SimpleSAML_Session::getInstance();

try {

	$spmeta = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrent();
	$spentityid = isset($_GET['spentityid']) ? $_GET['spentityid'] : $metadata->getMetaDataCurrentEntityID();
	
	if (!$spmeta['assertionConsumerServiceURL']) throw new Exception('The following parameter is not set in your SAML 2.0 SP Hosted metadata: assertionConsumerServiceURL');
	if (!$spmeta['SingleLogOutUrl']) throw new Exception('The following parameter is not set in your SAML 2.0 SP Hosted metadata: SingleLogOutUrl');
	
	$metaxml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EntityDescriptor entityID="' . $spentityid . '" xmlns="urn:oasis:names:tc:SAML:2.0:metadata">

	<SPSSODescriptor 
		AuthnRequestsSigned="false" 
		WantAssertionsSigned="false" 
		protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">

		<SingleLogoutService 
			Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" 
			Location="' . $spmeta['SingleLogOutUrl'] . '"/>
		
		<NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</NameIDFormat>
		
		<AssertionConsumerService 
			index="0" 
			isDefault="true" 
			Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" 
			Location="' .  $spmeta['assertionConsumerServiceURL']  . '" />

	</SPSSODescriptor>

</EntityDescriptor>';
	
	
	$et = new SimpleSAML_XHTML_Template($config, 'metadata.php');
	
	$et->data['header'] = 'SAML 2.0 SP Metadata';
	$et->data['metadata'] = htmlentities($metaxml);
	
	$et->show();
	
} catch(Exception $exception) {
{'fraction_non_alphanumeric': 0.1653836602930221, 'fraction_numerical': 0.009932952570151478, 'mean_word_length': 6.585687382297552, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 2, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5279871', 'n_tokens_mistral': 1444, 'n_tokens_neox': 1329, 'n_words': 214}