Custom Auth_Container

Custom Auth_Container -- Build a custom storage container

Custom Storage Containers

Here is a skeleton for a custom Auth storage container

Example 34-1. CustomAuthContainer.php


<?php
include_once 'Auth/Container.php';

class CustomAuthContainer extends Auth_Container
{
    /**
     * Constructor
     */
    function CustomAuthContainer($params)
    {
      // Init Here
    }

    function fetchData($username$password)
    {
        // Check If valid etc
        if($isvalid) {
            // Perform Some Actions
            return true;
        }
        return false;
    }
}
?>

And here is how to use it.

Example 34-2. authcustom.php


<?php
include_once 'CustomAuthContainer.php';
include_once 'Auth/Auth.php';

$auth_container = new CustomAuthContainer($params);
$myauth = new Auth($auth_container);

$myauth->start();
?>