From af2ea951ac61592a6cdb46686268ea36729f3d1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gyula=20Szab=C3=B3?= Date: Mon, 15 Jan 2018 15:57:04 +0100 Subject: [PATCH] hardcoded attribute name in getCredentials #2 --- README.md | 9 +++++---- Security/ShibbolethAuthenticator.php | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) 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']);