Twitter Feed

Xataface Maillist

Sign up to receive the Xataface news letter with weekly updates and development tips.

Found 1 of 138 records in table Wiki
Now Showing 1 of 1

Current Record: before_authenticate

before_authenticate hook


Return to Application Delegate Class

The before_authenticate hook is a method that can be defined in the Application Delegate Class which is called before the authentication step occurs on every request (not just on login). It is meant to be used to perform custom code that may affect the authentication settings.


This hook has been available since Xataface Version 1.2.5.


 * 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->setAuthType('basic');

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.

Chain Authentication Support

The most common use of this hook is likely to implement some sort of chain authentication, where authentication methods are attempted until one succeeds.

See Also

blog comments powered by Disqus
Powered by Xataface
(c) 2005-2018 All rights reserved