Skip to content

Commit cccfb2a

Browse files
author
Dani Pfeil
committed
[FEATURE] add login provider for the Backend
1 parent b386880 commit cccfb2a

File tree

6 files changed

+69
-3
lines changed

6 files changed

+69
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
4+
namespace DanielPfeil\Samlauthentication\Backend\LoginProvider;
5+
6+
7+
use TYPO3\CMS\Backend\Authentication\PasswordReset;
8+
use TYPO3\CMS\Backend\Controller\LoginController;
9+
use TYPO3\CMS\Backend\LoginProvider\LoginProviderInterface;
10+
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
11+
use TYPO3\CMS\Core\Page\PageRenderer;
12+
use TYPO3\CMS\Core\Utility\GeneralUtility;
13+
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
14+
use TYPO3\CMS\Fluid\View\StandaloneView;
15+
16+
class SamlLoginProvider implements LoginProviderInterface
17+
{
18+
public function render(StandaloneView $view, PageRenderer $pageRenderer, LoginController $loginController)
19+
{
20+
/**
21+
* @var $beuser BackendUserAuthentication
22+
*/
23+
$beuser = $GLOBALS["BE_USER"];
24+
$_POST["uident"] = rand();
25+
$beuser->start();
26+
27+
$pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/UserPassLogin');
28+
29+
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName('EXT:samlauthentication/Resources/Private/Templates/Backend/samllogin.html'));
30+
31+
$view->assign('enablePasswordReset', false);
32+
}
33+
}

Resources/Private/Language/locallang.xlf

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<file source-language="en" datatype="plaintext" original="messages" date="2011-10-18T18:20:51Z" product-name="my-ext">
2222
<header/>
2323
<body>
24+
<trans-unit id="login.simplesaml" xml:space="preserve">
25+
<source>Simplesaml Login</source>
26+
</trans-unit>
2427
<trans-unit id="fieldMapping" xml:space="preserve">
2528
<source>Field mapping</source>
2629
</trans-unit>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<f:layout name="Login" />
2+
3+
<f:section name="loginFormFields">
4+
<div class="form-group t3js-login-username-section" id="t3-login-username-section">
5+
<div class="form-control-wrap">
6+
<div class="form-control-holder">
7+
<input type="text" id="t3-username" name="username" value="{presetUsername}" aria-label="{f:translate(key: 'login.username')}" placeholder="{f:translate(key: 'login.username')}" class="form-control input-login t3js-clearable t3js-login-username-field" autofocus="autofocus" />
8+
<div class="form-notice-capslock hidden t3js-login-alert-capslock">
9+
<img src="{images.capslock}" width="14" height="14" alt="{f:translate(key: 'login.error.capslock')}" title="{f:translate(key: 'login.error.capslock')}" />
10+
</div>
11+
</div>
12+
</div>
13+
</div>
14+
</f:section>
15+
<f:section name="ResetPassword">
16+
<div class="forgot-password">
17+
<div class="text-right">
18+
<f:be.link route="password_forget" parameters="{loginProvider: loginProviderIdentifier}">{f:translate(key: 'login.password_forget')}</f:be.link>
19+
</div>
20+
</div>
21+
</f:section>

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"serviceprovider"
1111
],
1212
"license": "GPL-3.0-only",
13-
"version": "4.0.0",
13+
"version": "4.1.0",
1414
"require": {
1515
"typo3/minimal": ">=9",
1616
"simplesamlphp/simplesamlphp": "^1.19"

ext_emconf.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
$EM_CONF["samlauthentication"] = [
2121
'title' => 'SAML Authentication',
2222
'description' => 'This extension adds a authentication method for SAML with different service provider.',
23-
'version' => '4.0.0',
23+
'version' => '4.1.0',
2424
'category' => 'services',
2525
'constraints' => [
2626
'depends' => [

ext_localconf.php

+10-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,13 @@
3333

3434
'className' => 'DanielPfeil\\Samlauthentication\\Service\\AuthenticationService',
3535
]
36-
);
36+
);
37+
38+
$GLOBALS['TYPO3_CONF_VARS']['SVCONF']['auth']['setup']['BE_fetchUserIfNoSession'] = true;
39+
40+
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['backend']['loginProviders'][1433416020] = [
41+
'provider' => \DanielPfeil\Samlauthentication\Backend\LoginProvider\SamlLoginProvider::class,
42+
'sorting' => 50,
43+
'icon-class' => 'fa-key',
44+
'label' => 'LLL:EXT:samlauthentication/Resources/Private/Language/locallang.xlf:login.simplesaml'
45+
];

0 commit comments

Comments
 (0)