Skip to content

Commit

Permalink
hardcoded attribute name in getCredentials #2 register the moduleAttr…
Browse files Browse the repository at this point in the history
…ibute config variable into Configuration.php
  • Loading branch information
szabogyula committed Jan 15, 2018
1 parent af2ea95 commit 4187863
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 3 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public function getConfigTreeBuilder()
->scalarNode('usernameAttribute')
->defaultValue('REMOTE_USER')
->end()
->scalarNode('moduleAttribute')
->defaultValue('HTTP_SHIB_APPLICATION_ID')
->end()
->end()
;

Expand Down
5 changes: 1 addition & 4 deletions Security/ShibbolethAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit 4187863

Please sign in to comment.