Skip to content

Commit 3b70a25

Browse files
authored
feat: TICKET 0009388: Allow to force authentication to SSO (#382)
Co-authored-by: atisne <aurelien.tisne@cs-soprasteria.com>
1 parent 28810a5 commit 3b70a25

4 files changed

Lines changed: 18 additions & 7 deletions

File tree

config.inc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,9 @@
522522
//$tlCfg->authentication['SSO_uid_field'] = 'REMOTE_USER';
523523
//$tlCfg->authentication['SSO_user_target_dbfield'] = 'email';
524524

525+
// Allow to restrict authentication to SSO
526+
$tlCfg->authentication['sso_only'] = false;
527+
525528

526529
/**
527530
* LDAP authentication credentials, Multiple LDAP Servers can be used.

gui/templates/dashio/login/login-model-marcobiedermann.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<input type="hidden" name="ssodisable" value="{$gui->ssodisable}"/>
5050
{/if}
5151

52+
{if ! $gui->authCfg['sso_only']}
5253
<div class="form__field">
5354
<label for="tl_login"><i class="fa fa-user"></i></label>
5455
<input maxlength="{#LOGIN_MAXLEN#}" name="tl_login" id="tl_login" type="text" class="form__input" placeholder="{$labels.login_name}" required>
@@ -62,6 +63,7 @@
6263
<div class="form__field">
6364
<input id="tl_login_button" type="submit" value="{$labels.btn_login}">
6465
</div>
66+
{/if}
6567

6668
{foreach from=$gui->oauth item=oauth_item}
6769
<div class="button">

gui/templates/tl-classic/login/login-model-marcobiedermann.tpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
<input type="hidden" name="ssodisable" value="{$gui->ssodisable}"/>
5050
{/if}
5151

52+
{if ! $gui->authCfg['sso_only']}
5253
<div class="form__field">
5354
<label for="tl_login"><i class="fa fa-user"></i></label>
5455
<input maxlength="{#LOGIN_MAXLEN#}" name="tl_login" id="tl_login" type="text" class="form__input" placeholder="{$labels.login_name}" required>
@@ -62,6 +63,7 @@
6263
<div class="form__field">
6364
<input id="tl_login_button" type="submit" value="{$labels.btn_login}">
6465
</div>
66+
{/if}
6567

6668
{foreach from=$gui->oauth item=oauth_item}
6769
<div class="button">

login.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,17 @@ function init_gui(&$db,$args) {
246246
}
247247
}
248248

249-
$gui->external_password_mgmt = false;
250-
$domain = $gui->authCfg['domain'];
251-
$mm = $gui->authCfg['method'];
252-
if( isset($domain[$mm]) ) {
253-
$ac = $domain[$mm];
254-
$gui->external_password_mgmt = !$ac['allowPasswordManagement'];
255-
}
249+
if (isset($gui->authCfg['sso_only']) && $gui->authCfg['sso_only']) {
250+
$gui->external_password_mgmt = true;
251+
} else {
252+
$gui->external_password_mgmt = false;
253+
$domain = $gui->authCfg['domain'];
254+
$mm = $gui->authCfg['method'];
255+
if( isset($domain[$mm]) ) {
256+
$ac = $domain[$mm];
257+
$gui->external_password_mgmt = !$ac['allowPasswordManagement'];
258+
}
259+
}
256260

257261
$gui->login_disabled = (('LDAP' == $gui->authCfg['method']) && !checkForLDAPExtension()) ? 1 : 0;
258262

0 commit comments

Comments
 (0)