[TYPO3-dev] Hook in auth service

Rudy Gnodde rgn at windinternet.nl
Wed Nov 5 12:07:07 CET 2008


Hello everyone,

I have an auth service which logs users in using an external login 
service. This works fine. However the external login service does not 
give a lot of data about the user, only a unique id. This unique id can 
be used to get the data from a different source. No problems so far.

Now I want to release this extension so other people can also use it. 
However the external source for the user data does not have to be the 
same for other people. So I want to create a hook in the auth service 
where people can connect to their own user data source. This is done 
using the following code (copied from tt_news):

if 
(is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['myextensionkey']['userInfoHooks'])) 
{
	foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['myextensionkey']['userInfoHooks'] 
as $_classRef) {
		$_procObj = & t3lib_div::getUserObj($_classRef);
		$user = $_procObj->userInfoProcessor($user);
	}
}

This should work fine as far as I can see. I then add the following code 
to typo3conf/extTables.php:

require_once(t3lib_extMgm::extPath('myextensionkey') . 
'sv1/class.tx_myextensionkey_userext.php');
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['myextensionkey']['userInfoHooks'][] 
= 'tx_myextensionkey_userext';

When I tries to test it it didn't work. It seems the 
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['myextensionkey']['userInfoHooks'] 
array is empty. So extTables.php probably isn't loaded yet.

So I try to put the code in typo3conf/localconf.php instead. This causes 
an error in t3lib_extMgm::extPath because the extension hasn't been 
loaded yet.

My first question is: Is this the correct way to make a hook into my 
service?
My second question is: Where is the best place to add things to the hook 
and what is the best way to do it?

Thanks,

Rudy Gnodde
WIND Internet




More information about the TYPO3-dev mailing list