Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Using as part of Zend_Auth

In order to use the component as part of the Zend_Auth authentication system, you must use the provided Zend_Auth_Adapter_InfoCard to do so (not available in the standalone Zend_InfoCard distribution). An example of its usage is shown below:

if (isset($_POST['xmlToken'])) {

$adapter = new Zend_Auth_Adapter_InfoCard($_POST['xmlToken']);


$auth Zend_Auth::getInstance();

$result $auth->authenticate($adapter);

    switch (
$result->getCode()) {
$claims $result->getIdentity();
"Given Name: {$claims->givenname}<br />";
"Surname: {$claims->surname}<br />";
"Email Address: {$claims->emailaddress}<br />";
"PPI: {$claims->getCardID()}<br />";
"The Credential you provided did not pass validation";
"There was an error processing your credentials.";

    if (
count($result->getMessages()) > 0) {

<hr />
<div id="login" style="font-family: arial; font-size: 2em;">
<p>Simple Login Demo</p>
 <form method="post">
  <input type="submit" value="Login" />
   <object type="application/x-informationCard" name="xmlToken">
    <param name="tokenType"
          value="urn:oasis:names:tc:SAML:1.0:assertion" />
    <param name="requiredClaims"
                 http://.../claims/privatepersonalidentifier" />

In the example above, we first create an instance of the Zend_Auth_Adapter_InfoCard and pass the XML data posted by the card selector into it. Once an instance has been created you must then provide at least one SSL certificate public/private key pair used by the web server that received the HTTP POST. These files are used to validate the destination of the information posted to the server and are a requirement when using Information Cards.

Once the adapter has been configured, you can then use the standard Zend_Auth facilities to validate the provided information card token and authenticate the user by examining the identity provided by the getIdentity() method.

Zend Framework