<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
    <channel>
        <title>before_authenticate[ Search for &quot;&quot;]</title>
        <description></description>
        <link>http://xataface.com/wiki/index.php?-action=single_record_search&amp;-table=wiki&amp;page_id=%3D102&amp;-cursor=0&amp;-skip=0&amp;-limit=30&amp;-mode=list&amp;--subsearch=</link>
        <lastBuildDate>Fri, 24 May 2013 09:17:20 +0100</lastBuildDate>
        <generator>FeedCreator 1.7.2</generator>
        <item>
            <title>before_authenticate</title>
            <link>http://www.xataface.com/wiki/before_authenticate</link>
            <description>&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Field&lt;/th&gt;&lt;th&gt;Value&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page name&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;before_authenticate&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page id&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;102&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Page title&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;before_authenticate hook&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Content&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;&lt;p&gt;Return to &lt;a href=&quot;/wiki/Application_Delegate_Class&quot;&gt;Application Delegate Class&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;before_authenticate&lt;/strong&gt; hook is a method that can be defined in the &lt;a href=&quot;/wiki/Application_Delegate_Class&quot;&gt;Application Delegate Class&lt;/a&gt; which is called before the authentication step occurs on &lt;strong&gt;every&lt;/strong&gt; request (not just on login).  It is meant to be used to perform custom code that may affect the authentication settings.&lt;/p&gt;


&lt;h3 id=&quot;toc0&quot;&gt;Since&lt;/h3&gt;
&lt;p&gt;This hook has been available since Xataface Version 1.2.5.&lt;/p&gt;


&lt;h3 id=&quot;toc1&quot;&gt;Example&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;/**
 * Implemented trigger to be called before authentication to set the authentication
 * type to basic.
 */
function before_authenticate(){
    $auth = Dataface_AuthenticationTool::getInstance();
    if ( @$_SESSION['-login-type'] == 'basic' ) $auth-&amp;gt;setAuthType('basic');
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In the above example we used a separate action to store the user's preferred login type in a session variable.  This preference is then applied in the before_authenticate method to override the authentication type.&lt;/p&gt;


&lt;h3 id=&quot;toc2&quot;&gt;Chain Authentication Support&lt;/h3&gt;
&lt;p&gt;The most common use of this hook is likely to implement some sort of chain authentication, where authentication methods are attempted until one succeeds.&lt;/p&gt;


&lt;h3 id=&quot;toc3&quot;&gt;See Also&lt;/h3&gt;
&lt;ul&gt;
    &lt;li&gt; &lt;a href=&quot;/wiki/Application_Delegate_Class&quot;&gt;Application Delegate Class&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt; &lt;a href=&quot;/wiki/authentication&quot;&gt;authentication&lt;/a&gt; - Overview of Xataface authentication&lt;/li&gt;
    &lt;li&gt; &lt;a href=&quot;/wiki/Writing_Custom_Authentication_Plugins&quot;&gt;Writing Custom Authentication Plugins&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt; Authenticating Against the PHPBB Users Table&lt;a href=&quot;/wiki/index.php?-action=new&amp;-table=wiki&amp;page_name=Authenticating_Against_the_PHPBB_Users_Table&quot;&gt;?&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt; &lt;a href=&quot;/wiki/LDAP_or_Active_Directory&quot;&gt;LDAP or Active Directory&lt;/a&gt; - Using LDAP or Active Directory for authentication.&lt;/li&gt;
    &lt;li&gt; &lt;a href=&quot;http://xataface.com/documentation/tutorial/getting_started/permissions&quot; onclick=&quot;window.open(this.href, '_blank'); return false;&quot;&gt;Permissions Section of the Getting Started tutorial&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt; &lt;a href=&quot;/wiki/_auth&quot;&gt;_auth&lt;/a&gt; - Directives available in the &lt;a href=&quot;/wiki/_auth&quot;&gt;_auth&lt;/a&gt; section of the &lt;a href=&quot;/wiki/conf.ini_file&quot;&gt;conf.ini file&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Keywords&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;authentication&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign=&quot;top&quot;&gt;Language&lt;/td&gt;&lt;td valign=&quot;top&quot;&gt;en&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;</description>
            <author>before_authenticate</author>
        </item>
    </channel>
</rss>
