[TYPO3-mvc] tx_sv_authbase Authentication Service and ExtBase - TS Configuration Problems

Alexander heim alexander at alexander-heim.com
Tue Dec 27 09:14:19 CET 2011


Hi Claus,

sorry for my late answer.
I wrote a CommandController what extends 
Tx_Extbase_MVC_Controller_CommandController. It has the two functions 
for getting a user and authenticate the user. Nothing special. But I 
could not find any additional positive aspect with it. So I used 
$this->objectManager->get('Tx_Myextension_Command_MyCommandController') 
to get the controller. I did not initialized anything special before. 
But it seems like, that I should do this. Or how should the 
CommandController be used? Do I need to use a dispatcher? If yes, I 
would think to use it this way ... but somehow I have the feeling, it is 
wrong:

         $request = $this->objectManager->get('Tx_Extbase_MVC_CLI_Request');
         $dispatcher = 
$this->objectManager->get('Tx_Extbase_MVC_Dispatcher');
         $response = 
$this->objectManager->get('Tx_Extbase_MVC_CLI_Response');
         
$request->setControllerObjectName('TxCommand_Myextension__MyextensionCommandController');
         
$request->setControllerCommandName('getOrCreateFeUserAndGetFeUserId');
         $request->setArguments(array("login"=>$this->login['uname']));
         $dispatcher->dispatch($request, $response);

I also saw, that there are two public functions "canProcessRequest()" 
and "processRequest()". Would it be better to use them? Is Extbase 
intialized right at this point and is able to get the informations from 
TypoScript? So like:


         module.tx_Myextension.persistence.storagePid = 9
         module.tx_Myextension.persistence.newRecordStoragePid = 9

The Function "getOrCreateFeUserAndGetFeUserId" is a function from 
"TxCommand_Myextension__MyextensionCommandController" and returns false 
or the ID of the Frontend User of the given login.

If I use dispatch or processRequest ... where is the result of the 
called function stored? Should I use "output()" inside the command 
controller to return the result?

I know, a lot of questions, but I tried to search around inside the 
scheduler, but could not find a way to adapt it to my needs. I do not 
need the scheduler at this point or want to have access to the function 
from commandline. I just hope, this could be a good workaround, to make 
the functions available to the classical auth service.


Big thank you for your help
Alex





Am 19.12.2011 18:06, schrieb Claus Due:
> Hi Alexander,
>
> Perhaps you could make this work by compiling your own Request, initializing your Controller instance and running processRequest() on it. You may need to duplicate part of what goes on in the Bootstrap if you need your ConfigurationManager etc. present. In any case it's better than setting the $_GET variables manually and I don't know of any other way to manipulate those w/o GET/POST other than manually compiling your Request and sending it to the controller.
>
> Perhaps you would even prefer to use a CommandController - argument handling is somewhat easier with it and it's a bit faster, it also can be scheduled (it's in FED right now and in will be in the next version of Extbase) using scheduler [1]. The link also contians some basic info about CommandControllers.
>
> Cheers,
> Claus
>
> [1]http://fedext.net/features/scheduler-tasks/explanation/
>
> On Dec 19, 2011, at 5:54 PM, Alexander heim wrote:
>
>> I'm working at an additional Authentication Service for Typo3. I want to keep the authentication part as small as possible and created an extbase extension, which is doing most of the stuff. This works fine, except some problems, I could workaround.
>> But one problem still exists. At the moment I have to set storagePid and newRecordStoragePid inside my code. I tried to use the Tx_Extbase_Core_Bootstrap to initialize Extbase with some dummy plugin, controller, action stuff. I checked some of the examples for using the scheduler with some TSFE intializations and so on. Nothing worked. Maybe I forgot something or maybe I made some mistakes.
>> Has someone tried already to use an extbase extension from an implementation of Authentication Service?
>>
>> Some code:
>>
>> 	protected $storagePid = 9;
>> 	protected $newRecordStoragePid = 9;
>>
>> 	function initSomeTypo3Stuff() {
>> 		if (empty($GLOBALS['TSFE']->sys_page)) {
>> 			$GLOBALS['TSFE']->sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
>> 		}
>>
>> 		if (empty($GLOBALS['TSFE']->tmpl)) {
>>
>> 			$GLOBALS['TSFE']->tmpl = t3lib_div::makeInstance('t3lib_tstemplate');
>>
>> 		}
>>
>> 	}
>>
>> 	function initExtbase() {
>>
>> 		$configuration = array(
>>
>> 			'extensionName' =>   "extensionname",
>>
>> 			'pluginName' =>   "pi1",
>>
>> 			//'persistence' =>   '<   module.tx_extensionname.persistence',
>>
>> 			'persistence.'=>array('storagePid'=>$this->storagePid,'newRecordStoragePid'=>$this->newRecordStoragePid),
>>
>> 			'switchableControllerActions' =>   array(
>>
>> 				'BusinessUnits' =>   array('index'),
>>
>> 			)
>>
>> 		);
>>
>>
>> 		$_SERVER['REQUEST_METHOD'] = 'GET';
>>
>> 		$_GET['tx_extensionname_pi1']['controller'] = 'BusinessUnits';
>>
>> 		$_GET['tx_extensionname_pi1']['action'] = 'index';
>>
>> 		$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions']['extensionname']['modules']['pi1']['controllers'] = array(
>>
>> 			'BusinessUnits' =>   array(
>>
>> 				'actions' =>   array('index')
>>
>> 			),
>>
>> 		);
>>
>> 	
>> 		
>>
>> 		$this->extbaseBootstrap = t3lib_div::makeInstance('Tx_Extbase_Core_Bootstrap');
>>
>> 		$this->extbaseBootstrap->initialize($configuration);
>>
>> 	}
>>
>> 	function init() {
>>
>> 		$available = parent::init();
>>
>>     		$this->initSomeTypo3Stuff();
>>
>>     		$this->initExtbase();
>> 	}
>>
>>
>>
>> ------
>>
>> at TS is written:
>>
>> plugin.tx_extensionname.persistence.storagePid = 9
>> plugin.tx_extensionname.persistence.newRecordStoragePid = 9
>> module.tx_extensionname.persistence.storagePid = 9
>> module.tx_extensionname.persistence.newRecordStoragePid = 9
>>
>> ------
>>
>> and ext_localconf.php ... but this configuration is more like a dummy. I do not need any plugin at all.
>>
>> Tx_Extbase_Utility_Extension::configurePlugin(
>> 	$_EXTKEY,
>> 	'pi1',
>> 	array(
>> 		'BusinessUnits' =>   'index'
>> 	),
>> 	array(
>> 		'BusinessUnits' =>   'index'
>> 	)
>> 	
>> 	
>> );
>>
>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc




More information about the TYPO3-project-typo3v4mvc mailing list