From 418786363deaf47f2f13bd01dfdd3661d97bcfd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Gyula?= Date: Mon, 15 Jan 2018 16:40:43 +0100 Subject: [PATCH] hardcoded attribute name in getCredentials #2 register the moduleAttribute config variable into Configuration.php --- DependencyInjection/Configuration.php | 3 +++ Security/ShibbolethAuthenticator.php | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index a3fcad1..13b56eb 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -36,6 +36,9 @@ public function getConfigTreeBuilder() ->scalarNode('usernameAttribute') ->defaultValue('REMOTE_USER') ->end() + ->scalarNode('moduleAttribute') + ->defaultValue('HTTP_SHIB_APPLICATION_ID') + ->end() ->end() ; diff --git a/Security/ShibbolethAuthenticator.php b/Security/ShibbolethAuthenticator.php index cdba2ae..d809328 100644 --- a/Security/ShibbolethAuthenticator.php +++ b/Security/ShibbolethAuthenticator.php @@ -38,10 +38,7 @@ public function __construct($logger, $config, TokenStorage $tokenStorage, Router public function getCredentials(Request $request) { $this->logger->debug('[ShibbolethAuthenticator::getCredential]'); - $shibbolethModuleAttribute = 'HTTP_SHIB_APPLICATION_ID'; - if (array_key_exists('moduleAttribute', $this->config)) { - $shibbolethModuleAttribute = $this->config['moduleAttribute']; - }; + $shibbolethModuleAttribute = $this->config['moduleAttribute']; if ($request->server->has($shibbolethModuleAttribute)) { // What you return here will be passed to getUser() as $credentials $username = $request->server->get($this->config['usernameAttribute']);