<?php
defined('TYPO3_MODE') || die();

// Register Opentalent authentication service with TYPO3
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addService(
    'ot_connect',
    'auth',
    'tx_otconnect_service',
    [
        'title' => 'Opentalent Authentication',
        'description' => 'Opentalent authentication service for Frontend and Backend',
        'subtype' => 'getUserFE,authUserFE,getUserBE,authUserBE',
        'available' => true,
        'priority' => 80,
        // Priority must be higher than the priority of \TYPO3\CMS\Sv\AuthenticationService (50), or else failed login attempts will be logged each time
        'quality' => 80,
        'os' => '',
        'exec' => '',
        'className' => \Opentalent\OtConnect\Service\OtAuthenticationService::class
    ]
);

# Always call the getUser method if no session is active
$GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['setup']['FE_fetchUserIfNoSession'] = true;

// Use popup window to refresh login instead of the AJAX relogin:
$GLOBALS['TYPO3_CONF_VARS']['BE']['showRefreshLoginPopup'] = 1;
