Skip to content
Snippets Groups Projects
Commit 0af69a65 authored by Philipp Kolmann's avatar Philipp Kolmann Committed by Jaime Pérez Crespo
Browse files

Use auth sources by default by identifying them as "default" in the config. (+3 squashed commits)

Squashed commits:
[090679e6b] authsources must be an array
[1778d0c21] only set the AuthSource if it also exists, but always remove the config
variable.
[c09669e32] add the possibility to specify one AuthSource to be shown and the rest
are used via multiauth:MultiAuth
parent c81d33fc
No related branches found
No related tags found
No related merge requests found
<?php <?php
$config = [ $config = [
/*
* When multiple authentication sources are defined, you can specify one to use by default
* in order to authenticate users. In order to do that, you just need to name it "default"
* here. That authentication source will be used by default then when a user reaches the
* SimpleSAMLphp installation from the web browser, without passing through the API.
*
* If you already have named your auth source with a different name, you don't need to change
* it in order to use it as a default. Just create an alias by the end of this file:
*
* $config['default'] = &$config['your_auth_source'];
*/
// This is a authentication source which handles admin authentication. // This is a authentication source which handles admin authentication.
'admin' => [ 'admin' => [
......
...@@ -86,7 +86,7 @@ class Login ...@@ -86,7 +86,7 @@ class Login
} }
$attributes = $auth->getAttributes(); $attributes = $auth->getAttributes();
$session = Session::getSessionFromRequest(); $session = Session::getSessionFromRequest();
$t = new Template($this->config, 'auth_status.twig', 'attributes'); $t = new Template($this->config, 'auth_status.twig', 'attributes');
...@@ -132,11 +132,20 @@ class Login ...@@ -132,11 +132,20 @@ class Login
$as = key($this->sources); $as = key($this->sources);
} }
$default = false;
if (array_key_exists('default', $this->sources) && is_array($this->sources['default'])) {
$default = $this->sources['default'];
}
if ($as === null) { // no authentication source specified if ($as === null) { // no authentication source specified
$t = new Template($this->config, 'core:login.twig'); if (!$default) {
$t->data['loginurl'] = Utils\Auth::getAdminLoginURL(); $t = new Template($this->config, 'core:login.twig');
$t->data['sources'] = $this->sources; $t->data['loginurl'] = Utils\Auth::getAdminLoginURL();
return $t; $t->data['sources'] = $this->sources;
return $t;
}
// we have a default, use that one
$as = 'default';
} }
// auth source defined, check if valid // auth source defined, check if valid
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment