Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Groupbackend #3

Draft
wants to merge 85 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
4ba1040
Bump behat/behat from 3.10.0 to 3.11.0 in /tests/integration
dependabot[bot] Jul 9, 2022
34501f6
Bump onelogin/php-saml from 4.0.1 to 4.1.0 in /3rdparty
dependabot[bot] Jul 18, 2022
c7c64e4
Merge pull request #633 from nextcloud/dependabot/composer/tests/inte…
blizzz Jul 22, 2022
04e580d
Merge pull request #636 from nextcloud/dependabot/composer/3rdparty/o…
blizzz Jul 22, 2022
7c90ae6
[tx-robot] updated from transifex
nextcloud-bot Jul 26, 2022
52ac9ef
No SAML config chooser on env mode
blizzz Jul 28, 2022
0252b39
Merge pull request #639 from nextcloud/fix/noid/env-mode-no-chooser
juliusknorr Jul 28, 2022
0fdd38e
[tx-robot] updated from transifex
nextcloud-bot Aug 6, 2022
c058e17
[tx-robot] updated from transifex
nextcloud-bot Aug 24, 2022
fae25fa
fix signining in with IdPs other than 1
blizzz Aug 24, 2022
1bb98b4
Merge pull request #647 from nextcloud/fix/630/default-idp-value
PVince81 Aug 25, 2022
baed7e1
5.0.3
blizzz Aug 30, 2022
495ca29
Merge pull request #650 from nextcloud/release/noid/5.0.3
PVince81 Sep 1, 2022
c584bb3
l10n: Spelling unification
Valdnet Sep 4, 2022
94e1b17
l10n: Spelling unification
Valdnet Sep 4, 2022
38e8d0a
Merge pull request #653 from nextcloud/Valdnet-patch-1
rakekniven Sep 4, 2022
0a849da
[tx-robot] updated from transifex
nextcloud-bot Sep 5, 2022
312e3f1
[tx-robot] updated from transifex
nextcloud-bot Sep 6, 2022
dc2ed57
[tx-robot] updated from transifex
nextcloud-bot Sep 8, 2022
bf6926e
[tx-robot] updated from transifex
nextcloud-bot Sep 9, 2022
ff10ddc
[tx-robot] updated from transifex
nextcloud-bot Sep 13, 2022
7afb0b2
Bump guzzlehttp/guzzle from 7.4.5 to 7.5.0 in /tests/integration
dependabot[bot] Sep 13, 2022
7a78b3c
Merge pull request #652 from nextcloud/dependabot/composer/tests/inte…
blizzz Sep 13, 2022
676043b
fix fetching meta data with IdP id 1
blizzz Sep 21, 2022
b038c1f
[tx-robot] updated from transifex
nextcloud-bot Sep 22, 2022
f1cc92d
Merge pull request #656 from nextcloud/fix/noid/metadata-idp-1
blizzz Sep 22, 2022
cfad454
[tx-robot] updated from transifex
nextcloud-bot Sep 23, 2022
092cdcd
Add group backend to separate SAML groups from system/other groups
Deltachaos Aug 5, 2019
6b63c5a
move to migrations and add groups table
blizzz Oct 8, 2019
88c8f6f
adjust group manager and backend
blizzz Oct 8, 2019
5a04539
migrate local groups to SAML groups if applicable
blizzz Oct 11, 2019
ab34c6b
map original gid by saml and avoid collissions
blizzz Oct 21, 2019
80ec19e
cleaned up imports in UserBackend.php
JonathanTreffler Jul 5, 2021
ad49fc4
more UserBackend.php fixes
JonathanTreffler Jul 5, 2021
810ef7f
fixed migration
JonathanTreffler Jul 12, 2021
993529e
Fixes minor bugs
melegiul Jul 18, 2021
c5ff455
Implement backends add user to groups method
melegiul Jul 20, 2021
0b62b91
Fix bugs related to unit tests
melegiul Jul 22, 2021
5752511
Implement backend remove user from group method
melegiul Jul 26, 2021
68f76b6
Gid collision: append SAML prefix to gid
melegiul Jul 26, 2021
e90aca0
Use builtin user group ids getter
melegiul Jul 27, 2021
266a2f4
Only remove user groups from SAML backend
melegiul Jul 27, 2021
368195f
Sync user backend test
melegiul Jul 27, 2021
c43453e
Adds unit tests for group manager
melegiul Jul 29, 2021
49bc11c
Create new SAML group on gid collision
melegiul Jul 31, 2021
ae7528f
Delete SAML groups without members
melegiul Jul 31, 2021
efc1a68
Update group manager unit test
melegiul Aug 3, 2021
aac68c1
Adds group backend integration tests
melegiul Aug 5, 2021
6500677
Nextcloud 21 support
melegiul Aug 20, 2021
e6effba
Ensure admin cannot unassign SAML groups/members
melegiul Aug 20, 2021
9deba64
Register repair step for group migrations
melegiul Sep 8, 2021
80a53e5
Fix app code check compatibility 21
melegiul Sep 16, 2021
27a1a69
Fix unit tests
melegiul Sep 16, 2021
5c0bec0
Fix user backend unit tests
melegiul Sep 16, 2021
d162d92
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
662bcd0
Update lib/GroupDuplicateChecker.php
JonathanTreffler Sep 29, 2021
cbd0d18
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
4f3a5c7
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
19e55ce
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
78868b4
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
c815171
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
d6b46bf
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
eca9e26
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
65e632a
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
b4232fd
Apply suggestions from code review by @CarlSchwan
JonathanTreffler Sep 29, 2021
5f3a68e
Update lib/GroupManager.php
JonathanTreffler Sep 29, 2021
a40e812
Append SAML_ prefix to groups
melegiul Nov 29, 2021
e380b24
Add SAML prefix to migration
melegiul Dec 7, 2021
1b6cd24
Revert "Append SAML_ prefix to groups"
melegiul Dec 9, 2021
3991763
Update appinfo/app.php
JonathanTreffler Apr 26, 2022
dfdd465
Update appinfo/app.php
JonathanTreffler Apr 26, 2022
3121e6c
Update lib/GroupDuplicateChecker.php
JonathanTreffler Apr 26, 2022
266e959
Update lib/GroupDuplicateChecker.php
JonathanTreffler Apr 26, 2022
4c190ec
Update lib/GroupDuplicateChecker.php
JonathanTreffler Apr 26, 2022
8914615
Update lib/Jobs/MigrateGroups.php
JonathanTreffler Apr 26, 2022
c27e643
Update lib/Jobs/MigrateGroups.php
JonathanTreffler Apr 26, 2022
6745787
Update lib/UserBackend.php
JonathanTreffler Apr 26, 2022
26ee76c
Fix service registration closure parameters
melegiul Jul 13, 2022
aa76734
Fix query SAML settings
melegiul Jul 13, 2022
2146ac3
Update appinfo/app.php
melegiul Jul 14, 2022
50da9db
Add copyrights
melegiul Jul 14, 2022
c36d4b8
Fix php unit tests
melegiul Jul 14, 2022
fbc5c9b
Fix php code styles
melegiul Jul 14, 2022
49aa594
Fix phpunit xml file
melegiul Jul 14, 2022
7d7d56c
bump backend version and drop support for old Nextcloud releases
blizzz Sep 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 3rdparty/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# Changelog
All notable changes to this project will be documented in this file.

## 6.0.0 (unreleased)

### Added
- Group backend

### Changed
- drop support for Nextcloud 21 and 22

## 5.0.3
### Fixed
- Fix signining in with multiple IdPs
- Do not show config chooser when operating in env mode
### Changed
- Various dependency updates

## 5.0.2
### Fixed
- Fix setup with only one idp by using 1 as default value in routes
Expand Down
40 changes: 35 additions & 5 deletions appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,21 @@
*
*/

use OCA\User_SAML\GroupBackend;
use OCA\User_SAML\GroupDuplicateChecker;
use OCA\User_SAML\GroupManager;
use OCA\User_SAML\SAMLSettings;
use OCP\BackgroundJob\IJobList;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IUserManager;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;

require_once __DIR__ . '/../3rdparty/vendor/autoload.php';

// If we run in CLI mode do not setup the app as it can fail the OCC execution
// If we run in CLI mode do not set up the app as it can fail the OCC execution
// since the URLGenerator isn't accessible.
$cli = false;
if (OC::$CLI) {
Expand All @@ -35,11 +47,29 @@
$userSession = \OC::$server->getUserSession();
$session = \OC::$server->getSession();
} catch (Throwable $e) {
\OC::$server->getLogger()->logException($e);
/** @var LoggerInterface $logger */
$logger = \OC::$server->get(LoggerInterface::class);
$logger->critical($e->getMessage(), ['app' => 'user_saml', 'exception' => $e]);
return;
}

$samlSettings = \OC::$server->query(\OCA\User_SAML\SAMLSettings::class);
$groupBackend = \OC::$server->get(GroupBackend::class);
\OC::$server->get(IGroupManager::class)->addBackend($groupBackend);

$samlSettings = \OC::$server->get(SAMLSettings::class);

\OC::$server->registerService(GroupManager::class, function (ContainerInterface $c) use ($groupBackend, $samlSettings) {
return new GroupManager(
$c->get(IDBConnection::class),
$c->get(GroupDuplicateChecker::class),
$c->get(IGroupManager::class),
$c->get(IUserManager::class),
$groupBackend,
$c->get(IConfig::class),
$c->get(IJobList::class),
$samlSettings,
);
});

$userData = new \OCA\User_SAML\UserData(
new \OCA\User_SAML\UserResolver(\OC::$server->getUserManager()),
Expand All @@ -53,7 +83,7 @@
\OC::$server->getSession(),
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserManager(),
\OC::$server->getGroupManager(),
\OC::$server->get(OCA\User_SAML\GroupManager::class),
$samlSettings,
\OC::$server->getLogger(),
$userData,
Expand Down Expand Up @@ -156,7 +186,7 @@

$multipleUserBackEnds = $samlSettings->allowMultipleUserBackEnds();
$configuredIdps = $samlSettings->getListOfIdps();
$showLoginOptions = $multipleUserBackEnds || count($configuredIdps) > 1;
$showLoginOptions = ($multipleUserBackEnds || count($configuredIdps) > 1) && $type === 'saml';

if ($redirectSituation === true && $showLoginOptions) {
try {
Expand Down
9 changes: 7 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The following providers are supported and tested at the moment:
* Any other provider that authenticates using the environment variable

While theoretically any other authentication provider implementing either one of those standards is compatible, we like to note that they are not part of any internal test matrix.]]></description>
<version>5.0.2</version>
<version>6.0.0</version>
<licence>agpl</licence>
<author>Lukas Reschke</author>
<namespace>User_SAML</namespace>
Expand All @@ -33,8 +33,13 @@ While theoretically any other authentication provider implementing either one of
<screenshot>https://raw.githubusercontent.com/nextcloud/user_saml/master/screenshots/1.png</screenshot>
<screenshot>https://raw.githubusercontent.com/nextcloud/user_saml/master/screenshots/2.png</screenshot>
<dependencies>
<nextcloud min-version="21" max-version="25" />
<nextcloud min-version="23" max-version="25" />
</dependencies>
<repair-steps>
<post-migration>
<step>OCA\User_SAML\Migration\RememberLocalGroupsForPotentialMigrations</step>
</post-migration>
</repair-steps>
<commands>
<command>OCA\User_SAML\Command\ConfigCreate</command>
<command>OCA\User_SAML\Command\ConfigDelete</command>
Expand Down
9 changes: 0 additions & 9 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
'name' => 'SAML#login',
'url' => '/saml/login',
'verb' => 'GET',
'defaults' => [
'idp' => 1
],
],
[
'name' => 'SAML#base',
Expand All @@ -40,17 +37,11 @@
'name' => 'SAML#getMetadata',
'url' => '/saml/metadata',
'verb' => 'GET',
'defaults' => [
'idp' => 1
],
],
[
'name' => 'SAML#assertionConsumerService',
'url' => '/saml/acs',
'verb' => 'POST',
'defaults' => [
'idp' => 1
],
],
[
'name' => 'SAML#singleLogoutService',
Expand Down
10 changes: 1 addition & 9 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@
OCP.AppConfig.setValue('user_saml', 'type', '', {success: function() {location.reload();}});
},


getConfigIdentifier: function() {
if (this.currentConfig === '1') {
return '';
}
return this.currentConfig + '-';
},

/**
* Add a new provider
*/
Expand Down Expand Up @@ -131,7 +123,7 @@
// Checks on each request whether the settings make sense or not
$.ajax({
url: OC.generateUrl('/apps/user_saml/saml/metadata'),
data: { idp: OCA.User_SAML.Admin.getConfigIdentifier() },
data: { idp: this.currentConfig },
type: 'GET'
}).fail(function (e) {
if (e.status === 500) {
Expand Down
4 changes: 2 additions & 2 deletions l10n/bg.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions l10n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"Authenticate using single sign-on" : "Удостоверяване чрез еднократна идентификация",
"Using the SSO & SAML app of your Nextcloud you can make it easily possible to integrate your existing Single-Sign-On solution with Nextcloud. In addition, you can use the Nextcloud LDAP user provider to keep the convenience for users. (e.g. when sharing)\nThe following providers are supported and tested at the moment:\n\n* **SAML 2.0**\n\t* OneLogin\n\t* Shibboleth\n\t* Active Directory Federation Services (ADFS)\n\n* **Authentication via Environment Variable**\n\t* Kerberos (mod_auth_kerb)\n\t* Any other provider that authenticates using the environment variable\n\nWhile theoretically any other authentication provider implementing either one of those standards is compatible, we like to note that they are not part of any internal test matrix." : "С помощта на приложението SSO & SAML на вашия Nextcloud, можете лесно да направите възможно интегрирането на вашето съществуващо решение за еднократна идентификация с Nextcloud. В допълнение, можете да използвате потребителския доставчик на Nextcloud LDAP, за да запазите удобството за потребителите. (напр. при споделяне)\nВ момента се поддържат и тестват следните доставчици:\n\n* **SAML 2.0**\n\t* OneLogin\n\t* Shibboleth\n\t* Федерирани услуги на Active Directory (ADFS)\n\n* **Удостоверяване чрез променлива на средата**\n\t* Kerberos (mod_auth_kerb)\n\t* Всеки друг доставчик, който удостоверява с помощта на променливата на средата\n\nМакар че теоретично всеки друг доставчик на удостоверяване, внедряващ някой от тези стандарти, е съвместим, искаме да отбележим, че те не са част от която и да е вътрешна тестова матрица.",
"Open documentation" : "Отвори документацията",
"Make sure to configure an administrative user that can access the instance via SSO. Logging-in with your regular %s account won't be possible anymore, unless you enabled \"%s\" or you go directly to the URL %s." : "Уверете се, че сте конфигурирали административен потребител, който има достъп до потребителския модел чрез SSO. Влизането с вашия обикновен %s профил вече няма да е възможно, освен ако не сте активирали „%s“ или не отидете директно на URL адреса %s.",
"Make sure to configure an administrative user that can access the instance via SSO. Logging-in with your regular %s account won't be possible anymore, unless you go directly to the URL %s." : "Уверете се, че сте конфигурирали административен потребител, който има достъп до потребителския модел чрез SSO. Влизането с вашия обикновен %s профил вече няма да е възможно, освен не отидете директно на URL адреса %s.",
"Make sure to configure an administrative user that can access the instance via SSO. Logging-in with your regular %s account will not be possible anymore, unless you enabled \"%s\" or you go directly to the URL %s." : "Уверете се, че сте конфигурирали административен потребител, който има достъп до потребителския модел чрез SSO. Влизането с вашия обикновен %s профил вече няма да е възможно, освен ако не сте активирали „%s“ или не отидете директно на URL адрес %s.",
"Make sure to configure an administrative user that can access the instance via SSO. Logging-in with your regular %s account will not be possible anymore, unless you go directly to the URL %s." : "Уверете се, че сте конфигурирали административен потребител, който има достъп до потребителския модел чрез SSO. Влизането с вашия обикновен %s профил вече няма да е възможно, освен не отидете директно на URL адрес %s.",
"Please choose whether you want to authenticate using the SAML provider built-in in Nextcloud or whether you want to authenticate against an environment variable." : "Моля, изберете дали искате удостоверяване с помощта на SAML доставчика, вграден в Nextcloud, или искате удостоверяване срещу променлива на средата.",
"Use built-in SAML authentication" : "Ползвай вграденото SAML удостоверяване",
"Use environment variable" : "Използване на променлива на средата",
Expand Down
Loading