<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * This class overrides Kohana's Auth so that we can call a specific
 * Authentication driver.
 *
 * @package    OAuth
 * @category   Modifications
 * @author     Deon George
 * @copyright  (c) 2009-2013 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
abstract class Auth extends Kohana_Auth {
	public static function instance($type=NULL) {
		 if (is_null($type) OR (! $type instanceof Model_Oauth))
			return parent::instance();

		// Set the session class name
		$class = 'Auth_'.ucfirst($type->name);

		// Create a new session instance
		Auth::$_instance = new $class($type);

		return Auth::$_instance;
	}
}
?>