From 10d49a18383b5777d58a930076c239e1f96af25e Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Wed, 10 Aug 2011 06:48:40 +0000 Subject: [PATCH] multiauth: Add multiauth:preselect authentication parameter. Thanks to Josselin Jacquard for implementing this. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2887 44740490-163a-0410-bde0-09ae8108e29a --- modules/multiauth/docs/multiauth.txt | 9 ++++++++- modules/multiauth/www/selectsource.php | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/multiauth/docs/multiauth.txt b/modules/multiauth/docs/multiauth.txt index 93bd55e7e..4c0f52be2 100644 --- a/modules/multiauth/docs/multiauth.txt +++ b/modules/multiauth/docs/multiauth.txt @@ -64,4 +64,11 @@ For example: htttps://example.com/service/?source=saml will take you directly to the SAML authentication source, instead -of hitting the multiauth select page. +of hitting the multiauth select page, but this works only if you +don't have redirections during the authentification process. + +You can also use the multiauth:preselect parameter to the login call : + $as = new SimpleSAML_Auth_Simple('my-multiauth-authsource'); + $as->login(array( + 'multiauth:preselect' => 'default-sp', + )); diff --git a/modules/multiauth/www/selectsource.php b/modules/multiauth/www/selectsource.php index 41f0c73b3..2602f6f16 100644 --- a/modules/multiauth/www/selectsource.php +++ b/modules/multiauth/www/selectsource.php @@ -22,6 +22,9 @@ $state = SimpleSAML_Auth_State::loadState($authStateId, sspmod_multiauth_Auth_So if (array_key_exists('source', $_REQUEST)) { $source = $_REQUEST['source']; sspmod_multiauth_Auth_Source_MultiAuth::delegateAuthentication($source, $state); +} elseif (array_key_exists('multiauth:preselect', $state)) { + $source = $state['multiauth:preselect']; + sspmod_multiauth_Auth_Source_MultiAuth::delegateAuthentication($source, $state); } $globalConfig = SimpleSAML_Configuration::getInstance(); -- GitLab