diff --git a/README.md b/README.md index 790e643..bfd0482 100644 --- a/README.md +++ b/README.md @@ -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 ... ``` diff --git a/Security/ShibbolethAuthenticator.php b/Security/ShibbolethAuthenticator.php index 9f90b16..cdba2ae 100644 --- a/Security/ShibbolethAuthenticator.php +++ b/Security/ShibbolethAuthenticator.php @@ -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']);