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']);