<?php
	
	$config = SimpleSAML_Configuration::getInstance();
	$autoconfig = $config->copyFromBase('logininfocard', 'config-login-infocard.php');
	
	$ICconfig['InfoCard'] = $autoconfig->getValue('InfoCard');
	$ICconfig['InfoCard']['issuer'] = $autoconfig->getValue('tokenserviceurl'); //$autoconfig->getValue('sts_crt');
	
	$buf='';
	
	$buf .= '<sp: IssuedToken sp:Usage="" sp:IncludeToken="" >';
		$buf .= '<sp:Issuer>';
			$buf .= '<wsa:Address>';
				$buf .= $ICconfig['InfoCard']['issuer'];
			$buf .= '</wsa:Address>';
		$buf .= '</sp:Issuer>';
		
		$buf .= '<sp:RequestSecurityTokenTemplate>';
			$buf .= '<wst:KeyType>';
				$buf .= 'http://schemas.xmlsoap.org/ws/2005/02/trust/SymmetricKey';
			$buf .= '<wst:KeyType>';
			
			$buf .= '<wst:Claims Dialect="'.$ICconfig['InfoCard']['schema'].'">';
				foreach ($ICconfig['InfoCard']['requiredClaims'] as $reqClaim=>$tmp){
					$buf .= '<ic:ClaimType Uri="'.$ICconfig['InfoCard']['schema'].'/claims/'.$reqClaim.'" Optional="false">';
				}
				foreach ($ICconfig['InfoCard']['optionalClaims'] as $optClaim=>$tmp){
					$buf .= '<ic:ClaimType Uri="'.$ICconfig['InfoCard']['schema'].'/claims/'.$optClaim.'" Optional="true">';
				}
			$buf .= '</wst:Claims>';
		$buf .= '</sp:RequestSecurityTokenTemplate>';
		
	$buf .= '</sp:IssuedToken>';
	
	echo $buf;
?>