<?php 
    
require("infocard-lib.php");
?>
<html XMLNS:ic="http://www.identityselectors.org/2006/10">
    <head>
        <title>CDatazone Infocard test</title>
    </head>
    <body>
<?php if (empty($_POST['test'])) { ?>
    <form name="ctl00" id="ctl00" method="post" action="infocard.php">
        <input type="hidden" name="test" value="1" />
        <center>
            <img src='enter.gif' onClick='ctl00.submit()'/>
        </center>
        <OBJECT type="application/x-informationCard" name="xmlToken">
            <PARAM Name="tokenType" Value="urn:oasis:names:tc:SAML:1.0:assertion">
            <PARAM Name="requiredClaims" Value=
"http://schemas.microsoft.com/ws/2005/05/identity/claims/emailaddress http://schemas.microsoft.com/ws/2005/05/identity/claims/givenname http://schemas.microsoft.com/ws/2005/05/identity/claims/surname">
        </OBJECT>
    </form>
<?php 
} else {
    if (empty(
$_POST['xmlToken'])) {
?>
        <p>Unable to process the submission.<br />
        Make sure you have Windows Cardspace or equivalent installed</p>
<?php 
    
} else {
?>
    <p><b>Submitted Assertion Claims:</b></p>
<?php 
        $assertions 
= array();
        
$xmlToken stripslashes($_POST['xmlToken']);
        if (
$token processCard($xmlToken)) {
            
$assertions getAssertions($token);
            foreach (
$assertions AS $name=>$value) {
                if (
$name != 'privatepersonalidentifier') {
                    print 
$name.': '.$value.'<br />';
                }
            }
        }
        if (
count($assertions) == 0) {
            print 
"<p>NONE</p>";
        }
    }
}
?>
    </body>
</html>