cvs: peardoc /en/package/authentication auth.xml /en/package/authentication/auth intro-logging.xml intro-storage.xml
/en/package/authentication/auth/auth attachlogobserver.xml /en/package/authentication/auth/storage multiple.xml

From: Date: Wed, 17 Jan 2007 07:03:23 +0000
Subject: cvs: peardoc /en/package/authentication auth.xml /en/package/authentication/auth intro-logging.xml intro-storage.xml
/en/package/authentication/auth/auth attachlogobserver.xml /en/package/authentication/auth/storage multiple.xml
Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-9323@lists.php.net to get a copy of this message
aashley Wed Jan 17 07:03:23 2007 UTC Added files: /peardoc/en/package/authentication/auth intro-logging.xml /peardoc/en/package/authentication/auth/auth attachlogobserver.xml /peardoc/en/package/authentication/auth/storage multiple.xml Modified files: /peardoc/en/package/authentication auth.xml /peardoc/en/package/authentication/auth intro-storage.xml Log: Updated auth documentation for Auth 1.5.0

http://cvs.php.net/viewvc.cgi/peardoc/en/package/authentication/auth.xml?r1=1.10&r2=1.11&diff_format=u Index: peardoc/en/package/authentication/auth.xml diff -u peardoc/en/package/authentication/auth.xml:1.10 peardoc/en/package/authentication/auth.xml:1.11 --- peardoc/en/package/authentication/auth.xml:1.10 Wed Dec 6 01:20:54 2006 +++ peardoc/en/package/authentication/auth.xml Wed Jan 17 07:03:22 2007 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <sect1 id="package.authentication.auth"> <title>Auth</title> @@ -8,6 +8,7 @@ &package.authentication.auth.intro; &package.authentication.auth.intro-storage; + &package.authentication.auth.intro-logging; &package.authentication.auth.storage.array; &package.authentication.auth.storage.db; @@ -18,6 +19,7 @@ &package.authentication.auth.storage.ldap; &package.authentication.auth.storage.mdb; &package.authentication.auth.storage.mdb2; + &package.authentication.auth.storage.multiple; &package.authentication.auth.storage.pear; &package.authentication.auth.storage.pop3; &package.authentication.auth.storage.radius; @@ -34,6 +36,7 @@ &package.authentication.auth.auth.auth; &package.authentication.auth.auth.adduser; + &package.authentication.auth.auth.attachlogobserver; &package.authentication.auth.auth.changepassword; &package.authentication.auth.auth.checkauth; &package.authentication.auth.auth.getauth; http://cvs.php.net/viewvc.cgi/peardoc/en/package/authentication/auth/intro-storage.xml?r1=1.18&r2=1.19&diff_format=u Index: peardoc/en/package/authentication/auth/intro-storage.xml diff -u peardoc/en/package/authentication/auth/intro-storage.xml:1.18 peardoc/en/package/authentication/auth/intro-storage.xml:1.19 --- peardoc/en/package/authentication/auth/intro-storage.xml:1.18 Mon Sep 11 02:11:21 2006 +++ peardoc/en/package/authentication/auth/intro-storage.xml Wed Jan 17 07:03:22 2007 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.18 $ --> +<!-- $Revision: 1.19 $ --> <refentry id="package.authentication.auth.intro-storage"> <refnamediv> <refname>Storage drivers</refname> @@ -147,6 +147,21 @@ <varlistentry> <term> <literal> + <link linkend="package.authentication.auth.storage.multiple"> + Multiple + </link> + </literal> + </term> + <listitem> + <para> + Storage container for using multiple + <classname>Auth_Containers</classname> in a fall through manner. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term> + <literal> <link linkend="package.authentication.auth.storage.pear"> PEAR </link> http://cvs.php.net/viewvc.cgi/peardoc/en/package/authentication/auth/intro-logging.xml?view=markup&rev=1.1 Index: peardoc/en/package/authentication/auth/intro-logging.xml +++ peardoc/en/package/authentication/auth/intro-logging.xml <!-- $Revision: 1.1 $ --> <refentry id="package.authentication.auth.intro-logging"> <refnamediv> <refname>Logging</refname> <refpurpose>Introduction</refpurpose> </refnamediv> <refsect1 id="package.authentication.auth.intro-logging.overview"> <title>Overview</title> <para> Since version 1.5.0 <classname>PEAR::Auth</classname> provides a facility for retrieving logs of its internal behaviour. This is implemented using <link linkend="package.logging.log"><classname>PEAR::Log</classname></link> and its log observer components. </para> <para> <classname>Auth</classname> provides two levels of log messages which map to the <classname>Log</classname> priority levels <constant>PEAR_LOG_INFO</constant> and <constant>PEAR_LOG_DEBUG</constant>. </para> <para> <constant>PEAR_LOG_INFO</constant> messages provide basic information about <classname>Auth</classname>'s decisions, for example user authentication successful/failed, rendering login screen. </para> <para> <constant>PEAR_LOG_DEBUG</constant> messages provide detailed information about what is happening within the internals of Auth, for example which functions are called, logic tracking for the Authentication method, what SQL queries are being run against the database backends. </para> </refsect1> <refsect1 id="package.authentication.auth.intro-logging.example"> <title>Example</title> <example> <title>Typical usage example for accessing the logs from <classname>PEAR::Auth</classname></title> <programlisting role="php"> <![CDATA[ require_once "Auth.php"; require_once 'Log.php'; require_once 'Log/observer.php'; // Callback function to display login form function loginFunction($username = null, $status = null, &$auth = null) { /* * Change the HTML output so that it fits to your * application. */ echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">"; echo "Username: <input type=\"text\" name=\"username\"><br/>"; echo "Password: <input type=\"password\" name=\"password\"><br/>"; echo "<input type=\"submit\">"; echo "</form>"; } class Auth_Log_Observer extends Log_observer { var $messages = array(); function notify($event) { $this->messages[] = $event; } } $options = array( 'enableLogging' => true, 'cryptType' => 'md5', 'users' => array( 'guest' => md5('password'), ), ); $a = new Auth("Array", $options, "loginFunction"); $infoObserver = new Auth_Log_Observer(PEAR_LOG_INFO); $a->attachLogObserver($infoObserver); $debugObserver = new Auth_Log_Observer(PEAR_LOG_DEBUG); $a->attachLogObserver($debugObserver); $a->start(); if ($a->checkAuth()) { /* * The output of your site goes here. */ print "Authentication Successful.<br/>"; } print '<h3>Logging Output:</h3>' .'<b>PEAR_LOG_INFO level messages:</b><br/>'; foreach ($infoObserver->messages as $event) { print $event['priority'].': '.$event['message'].'<br/>'; } print '<br/>' .'<b>PEAR_LOG_DEBUG level messages:</b><br/>'; foreach ($debugObserver->messages as $event) { print $event['priority'].': '.$event['message'].'<br/>'; } print '<br/>'; ]]> </programlisting> <para> To enable logging pass the option <quote>enableLogging</quote> with the value &true; in the options array in the second parameter to the Auth constructor. </para> <para> To retrieve the log messages from Auth create a new subclass of <classname>Log_Observer</classname> that implements a <function>notify</function> function to perform whatever actions you want on the log messages. </para> <para> Once defined pass an instance of your new <classname>Log_Observer</classname> instance to <link linkend="package.authentication.auth.auth.attachlogobserver"> <classname>Auth</classname>::<function>attachLogObserver</function></link>. </para> <para> To limit the types of messages you receive in the <classname>Log_Observer</classname> pass either <constant>PEAR_LOG_INFO</constant> or <constant>PEAR_LOG_DEBUG</constant> as the first parameter to the <classname>Log_Observer</classname>. The default is <constant>PEAR_LOG_INFO</constant>. For more information on this filtering see the <link linkend="package.logging.log">Log Documentation</link>. </para> <programlisting role="php"> <![CDATA[ $observer = new My_Log_Observer(PEAR_LOG_DEBUG); ]]> </programlisting> </example> </refsect1> <refsect1 id="package.authentication.auth.intro-logging.note"> &title.note; <para> This container has only been available since version 1.5.0. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/authentication/auth/auth/attachlogobserver.xml?view=markup&rev=1.1 Index: peardoc/en/package/authentication/auth/auth/attachlogobserver.xml +++ peardoc/en/package/authentication/auth/auth/attachlogobserver.xml <!-- $Revision: 1.1 $ --> <refentry id="package.authentication.auth.auth.attachlogobserver"> <refnamediv> <refname>Auth::attachLogObserver()</refname> <refpurpose>Attach a log observer instance to the internal Log object</refpurpose> </refnamediv> <refsynopsisdiv> <funcsynopsis> <funcprototype> <funcdef>void <function>Auth::attachLogObserver</function></funcdef> <paramdef>object <parameter>&amp;$observer</parameter></paramdef> </funcprototype> </funcsynopsis> </refsynopsisdiv> <refsect1 id="package.authentication.auth.auth.attachlogobserver.desc"> &title.desc; <para> Attach an instance of a Log_Observer to the internal Log object. This allows the internal logs to be accessed and used as you wish within your application. </para> </refsect1> <refsect1 id="package.authentication.auth.auth.attachlogobserver.parameter"> &title.param; <para> <variablelist> <varlistentry> <term> &type.object; <parameter>&amp;$observer</parameter> </term> <listitem> <para> The instance of the <classname>Log_Observer</classname> to attach to the internal Log object. </para> </listitem> </varlistentry> </variablelist> </para> </refsect1> <refsect1 id="package.authentication.auth.auth.attachlogobserver.note"> &title.note; &note.notstatic; <para> This function has only been available since version 1.5.0. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 --> http://cvs.php.net/viewvc.cgi/peardoc/en/package/authentication/auth/storage/multiple.xml?view=markup&rev=1.1 Index: peardoc/en/package/authentication/auth/storage/multiple.xml +++ peardoc/en/package/authentication/auth/storage/multiple.xml <!-- $Revision: 1.1 $ --> <refentry id="package.authentication.auth.storage.multiple"> <refnamediv> <refname>Auth_Container_Multiple</refname> <refpurpose>Authenticate against multiple Auth_Containers</refpurpose> </refnamediv> <refsect1 id="package.authentication.auth.storage.multiple.overview"> <title>Multiple</title> <para> This container provides a facility to attempt to authenticate against multiple Auth_Containers in order. </para> <para> If a container's <function>getAuthData</function> returns true <classname>Auth_Container_Multiple</classname> will return true. </para> <para> When a container's <function>getAuthData</function> returns false <classname>Auth_Container_Multiple</classname> will continue on through the list of available containers until a successful login is found or the list of containers is expired. </para> <para> On receipt of an error from <function>getAuthData</function> <classname>Auth_Container_Multiple</classname> will abort checking further containers and return the error. </para> <para> The storage-specific argument for the <link linkend="package.authentication.auth.auth.auth"> <function>Auth constructor</function> </link> is an array of container configurations. Each container configuration has the following options: <table> <title>Available Options</title> <tgroup cols="4"> <thead> <row> <entry>Option</entry> <entry>Data Type</entry> <entry>Default value</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry> <quote>type</quote> </entry> <entry> &type.string; </entry> <entry> <quote></quote> </entry> <entry> The type of container to instanciate. This is the same value as used in the first parameter of the <link linkend="package.authentication.auth.auth.auth"> <function>Auth constructor</function> </link>. </entry> </row> <row> <entry> <quote>options</quote> </entry> <entry> &type.array; </entry> <entry> array() </entry> <entry> This is the standard array of options required for the container. </entry> </row> </tbody> </tgroup> </table> </para> <example> <title>Example usage of <classname>Auth_Container_Multiple</classname></title> <programlisting role="php"> <![CDATA[ require_once "Auth.php"; require_once 'Log.php'; require_once 'Log/observer.php'; // Callback function to display login form function loginFunction($username = null, $status = null, &$auth = null) { /* * Change the HTML output so that it fits to your * application. */ echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">"; echo "Username: <input type=\"text\" name=\"username\"><br/>"; echo "Password: <input type=\"password\" name=\"password\"><br/>"; echo "<input type=\"submit\">"; echo "</form>"; } class Auth_Log_Observer extends Log_observer { var $messages = array(); function notify($event) { $this->messages[] = $event; } } $options = array( 'enableLogging' => true, array( 'type' => 'Array', 'options' => array( 'cryptType' => 'md5', 'users' => array( 'guest' => md5('password'), ), ), ), array( 'type' => 'Array', 'options' => array( 'cryptType' => 'md5', 'users' => array( 'admin' => md5('password'), ), ), ), ); $a = new Auth("Multiple", $options, "loginFunction"); $infoObserver = new Auth_Log_Observer(PEAR_LOG_INFO); $a->attachLogObserver($infoObserver); $debugObserver = new Auth_Log_Observer(PEAR_LOG_DEBUG); $a->attachLogObserver($debugObserver); $a->start(); if ($a->checkAuth()) { /* * The output of your site goes here. */ print "Authentication Successful.<br/>"; } print '<h3>Logging Output:</h3>' .'<b>PEAR_LOG_INFO level messages:</b><br/>'; foreach ($infoObserver->messages as $event) { print $event['priority'].': '.$event['message'].'<br/>'; } print '<br/>' .'<b>PEAR_LOG_DEBUG level messages:</b><br/>'; foreach ($debugObserver->messages as $event) { print $event['priority'].': '.$event['message'].'<br/>'; } print '<br/>'; ]]> </programlisting> </example> </refsect1> <refsect1 id="package.authentication.auth.storage.multiple.note"> &title.note; <para> This container has only been available since version 1.5.0. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->
« previous php.pear.doc (#9323) next »