diff --git a/CHANGELOG.md b/CHANGELOG.md index a142150..3b2f486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ CHANGELOG ========= +Version 1.5.1 +------------- +* Hotfixes wrong links in 403 error page if enforce authentication was on +* Hotfixes wrong translation in 403 error page for ECAS instances +* Removes return type hints not compatible with PHP 5.6 +* Adds functionality to provide more than one mapping field to ownCloud userdata fields (e.g. DisplayName can now be concatenated by a firstname and a lastname CAS-field) + Version 1.5.0 ------------- * Drop ownCloud 9 support diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dcc0239..fa108c5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,10 +1,6 @@ ## Submitting issues -If you have questions about how to install or use ownCloud, please direct these to the [mailing list][mailinglist] or our [forum][forum]. We are also available on [IRC][irc]. - -### Short version - - * The [**issue template can be found here**][template]. Please always use the issue template when reporting issues. +If you have questions about how to install or use ownCloud, please direct these to the [mailing list][mailinglist], the [forum][forum] or the [IRC Chat][irc]. ### Guidelines * Please search the existing issues first, it's likely that your issue was already reported or even fixed. @@ -13,13 +9,12 @@ If you have questions about how to install or use ownCloud, please direct these - More info on [search syntax within github](https://help.github.com/articles/searching-issues) * This repository ([user_cas](https://github.com/felixrupp/user_cas/issues)) is *only* for issues within the ownCloud user_cas code. * __SECURITY__: Report any potential security bug to security@owncloud.com following our [security policy](https://owncloud.org/security/) instead of filing an issue in our bug tracker -* Report the issue using our [template][template], it includes all the information we need to track down the issue. +* Report the issue using our template, it includes all the information we need to track down the issue. Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. -[template]: https://raw.github.com/owncloud/core/master/issue_template.md [mailinglist]: https://mailman.owncloud.org/mailman/listinfo/owncloud -[forum]: https://forum.owncloud.org/ +[forum]: https://central.owncloud.org [irc]: https://webchat.freenode.net/?channels=owncloud&uio=d4 ### Contribute Code and translations diff --git a/README.md b/README.md index 083628e..34f556d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ INTRODUCTION ============ -This App provides CAS authentication support, using the phpcas library of jasig/apereo. +This App provides CAS authentication support, using the phpCAS library of jasig/apereo. INSTALLATION ============ @@ -9,14 +9,14 @@ INSTALLATION DEPENDENCIES ------------------- -* ownCloud 10.0.0 or higher +* ownCloud 10.0.0 to 10.0.7 and Nextcloud 13.0.0 to 13.0.3 * PHP >= 5.6, PHP 7.0 or 7.1 if possible -* [Composer Dependency Manager](https://getcomposer.org/), if you want to install via GIT. +* Optional: [Composer Dependency Manager](https://getcomposer.org/), if you want to install via GIT. -This app does not require a standalone version of jasig’s/apereo’s phpcas any longer. The library is shipped within composer dependencies or in the archive file you downloaded. Although you can configure to use your own version of jasig’s/apereo’s phpcas library later on. +This app does not require a standalone version of jasig’s/apereo’s phpCAS any longer. The library is shipped within composer dependencies, in the archive file you downloaded or the Market/App-Store version if used. Although you can configure to use your own version of jasig’s/apereo’s phpCAS library later on. -STEPS +GIT: STEPS ----- 1. Git clone/copy the downloaded `user_cas` folder into the ownCloud's apps folder and make sure to set correct permissions for your Webserver. @@ -24,7 +24,7 @@ STEPS 3. Adjust the settings for the `user_cas` folder according to your webserver setup. 4. Access the ownCloud web interface with a locally created ownCloud user with admin privileges. 5. Access the administrations panel => Apps and enable the **CAS user and group backend** app. -6. Access the administration panel => Authentication and configure the app. +6. Access the administration panel => Authentication (Additional on Nextcloud) and configure the app. CONFIGURATION @@ -72,7 +72,7 @@ If CAS provides extra attributes, `user_cas` can retrieve the values of them. Si **Email**: Name of email attribute in CAS. Default: empty -**Display Name**: Name of display name attribute in CAS (this might be the "real name" of a user). Default: empty +**Display Name**: Name of display name attribute(s) in CAS (this might be the "real name" of a user or a combination of two fields like: firstnames+surnames). Default: empty **Group**: Name of group attribute in CAS. Default: empty @@ -92,7 +92,7 @@ Groups ECAS Settings: -------------- -user_cas since Version 1.5 provides support for using a European Commission ECAS-Server implementation. +Since Version 1.5 user_cas provides support for using a European Commission ECAS-Server implementation. **Use ECAS Attribute Parser?**: Activate the ECAS attribute parser to enable the parsing of groups provided by the European Commission ECAS implementation (do NOT activate until you know what you are doing). @@ -138,18 +138,6 @@ Bugs and Support ============== Please contribute bug reports and feedback to [GitHub Issues](https://github.com/felixrupp/user_cas/issues). -If you are observing undesired behaviour, think it is a bug and want to tell me about, please include following parts: -* What led up to the situation? -* What exactly did you do (or not do) that was effective (or ineffective)? -* What was the outcome of this action? -* What outcome did you expect instead? - -Also please provide basic information of your ownCloud instance: -* ownCloud Version -* PHP Version -* CAS Version -* phpCAS library version -* The part of the owncloud.log file, from -5min. before and +5min. after the bug happened ABOUT ===== diff --git a/lib/Hooks/UserHooks.php b/lib/Hooks/UserHooks.php index c86d9e2..97ad14a 100644 --- a/lib/Hooks/UserHooks.php +++ b/lib/Hooks/UserHooks.php @@ -251,15 +251,31 @@ public function postLogin(\OCP\IUser $user, $password) $attributes = array(); $this->loggingService->write(\OCP\Util::DEBUG, 'Attributes for the user: ' . $uid . ' => ' . $casAttributesString); + + // DisplayName $displayNameMapping = $this->config->getAppValue($this->appName, 'cas_displayName_mapping'); - if (array_key_exists($displayNameMapping, $casAttributes)) { - $attributes['cas_name'] = $casAttributes[$displayNameMapping]; - } else if (array_key_exists('displayName', $casAttributes)) { + $displayNameMappingArray = explode("+", $displayNameMapping); + + $attributes['cas_name'] = ''; + + foreach($displayNameMappingArray as $displayNameMapping) { + + if (array_key_exists($displayNameMapping, $casAttributes)) { + + $attributes['cas_name'] .= $casAttributes[$displayNameMapping]." "; + } + } + + $attributes['cas_name'] = trim($attributes['cas_name']); + + if ($attributes['cas_name'] === '' && array_key_exists('displayName', $casAttributes)) { $attributes['cas_name'] = $casAttributes['displayName']; } + + // E-Mail $mailMapping = $this->config->getAppValue($this->appName, 'cas_email_mapping'); if (array_key_exists($mailMapping, $casAttributes)) { diff --git a/lib/Service/AppService.php b/lib/Service/AppService.php index 2e00b2b..58ca012 100644 --- a/lib/Service/AppService.php +++ b/lib/Service/AppService.php @@ -707,7 +707,7 @@ public function setCasServiceUrl($casServiceUrl) /** * @return bool */ - public function isCasDisableLogout(): bool + public function isCasDisableLogout() { return $this->casDisableLogout; } @@ -715,7 +715,7 @@ public function isCasDisableLogout(): bool /** * @param bool $casDisableLogout */ - public function setCasDisableLogout(bool $casDisableLogout) + public function setCasDisableLogout($casDisableLogout) { $this->casDisableLogout = $casDisableLogout; } @@ -723,7 +723,7 @@ public function setCasDisableLogout(bool $casDisableLogout) /** * @return string */ - public function getCasEcasAcceptedStrengths(): string + public function getCasEcasAcceptedStrengths() { return $this->cas_ecas_accepted_strengths; } @@ -731,7 +731,7 @@ public function getCasEcasAcceptedStrengths(): string /** * @param string $cas_ecas_accepted_strengths */ - public function setCasEcasAcceptedStrengths(string $cas_ecas_accepted_strengths) + public function setCasEcasAcceptedStrengths($cas_ecas_accepted_strengths) { $this->cas_ecas_accepted_strengths = $cas_ecas_accepted_strengths; } @@ -739,7 +739,7 @@ public function setCasEcasAcceptedStrengths(string $cas_ecas_accepted_strengths) /** * @return string */ - public function getCasEcasRetrieveGroups(): string + public function getCasEcasRetrieveGroups() { return $this->cas_ecas_retrieve_groups; } @@ -747,7 +747,7 @@ public function getCasEcasRetrieveGroups(): string /** * @param string $cas_ecas_retrieve_groups */ - public function setCasEcasRetrieveGroups(string $cas_ecas_retrieve_groups) + public function setCasEcasRetrieveGroups($cas_ecas_retrieve_groups) { $this->cas_ecas_retrieve_groups = $cas_ecas_retrieve_groups; } @@ -755,7 +755,7 @@ public function setCasEcasRetrieveGroups(string $cas_ecas_retrieve_groups) /** * @return string */ - public function getCasEcasAssuranceLevel(): string + public function getCasEcasAssuranceLevel() { return $this->cas_ecas_assurance_level; } @@ -763,7 +763,7 @@ public function getCasEcasAssuranceLevel(): string /** * @param string $cas_ecas_assurance_level */ - public function setCasEcasAssuranceLevel(string $cas_ecas_assurance_level) + public function setCasEcasAssuranceLevel($cas_ecas_assurance_level) { $this->cas_ecas_assurance_level = $cas_ecas_assurance_level; } @@ -771,7 +771,7 @@ public function setCasEcasAssuranceLevel(string $cas_ecas_assurance_level) /** * @return bool */ - public function isEcasAttributeParserEnabled(): bool + public function isEcasAttributeParserEnabled() { return $this->ecasAttributeParserEnabled; } @@ -779,7 +779,7 @@ public function isEcasAttributeParserEnabled(): bool /** * @param bool $ecasAttributeParserEnabled */ - public function setEcasAttributeParserEnabled(bool $ecasAttributeParserEnabled) + public function setEcasAttributeParserEnabled($ecasAttributeParserEnabled) { $this->ecasAttributeParserEnabled = $ecasAttributeParserEnabled; } @@ -787,7 +787,7 @@ public function setEcasAttributeParserEnabled(bool $ecasAttributeParserEnabled) /** * @return bool */ - public function isCasEcasRequestFullUserdetails(): bool + public function isCasEcasRequestFullUserdetails() { return $this->cas_ecas_request_full_userdetails; } @@ -795,7 +795,7 @@ public function isCasEcasRequestFullUserdetails(): bool /** * @param bool $cas_ecas_request_full_userdetails */ - public function setCasEcasRequestFullUserdetails(bool $cas_ecas_request_full_userdetails) + public function setCasEcasRequestFullUserdetails($cas_ecas_request_full_userdetails) { $this->cas_ecas_request_full_userdetails = $cas_ecas_request_full_userdetails; }