Skip to content

Commit

Permalink
hardcoded attribute name in getCredentials #2
Browse files Browse the repository at this point in the history
  • Loading branch information
szabogyula committed Jan 15, 2018
1 parent ea84486 commit af2ea95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ update your ```app/config/config.yml```
...
niif_shib_auth: ~
# niif_shib_auth:
# baseURL: "%shib_auth_base_url%" # optional, have default value: /Shibboleth.sso/
# sessionInitiator: "%shib_auth_session_initiator%" # optional, have default value: Login
# logoutPath: "%shib_auth_logout_path%" # optional, have default value: Logout
# logoutReturnPath: "%shib_auth_logout_return_path%" # optional, have default value: "/" you should use absolute url, or named symfony route too.
# baseURL: "%shib_auth_base_url%" # optional, have default value: /Shibboleth.sso/
# sessionInitiator: "%shib_auth_session_initiator%" # optional, have default value: Login
# logoutPath: "%shib_auth_logout_path%" # optional, have default value: Logout
# logoutReturnPath: "%shib_auth_logout_return_path%" # optional, have default value: "/" you should use absolute url, or named symfony route too.
# usernameAttribute: "%shib_auth_username_attribute%" # optional, have default value: REMOTE_USER
# moduleAttribute: "%shib_auth_module_attribute%" # optional, the name of the server variable for ensure shibboleth session exist default: HTTP_SHIB_APPLICATION_ID
...
```

Expand Down
3 changes: 3 additions & 0 deletions Security/ShibbolethAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ 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'];
};
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 af2ea95

Please sign in to comment.