Skip to content

Commit 8c80c69

Browse files
authored
Move to SSP UI (#267)
* Move to SSP UI --------- Co-authored-by: Marko Ivančić <[email protected]>
1 parent d59b3d0 commit 8c80c69

File tree

152 files changed

+3889
-13315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+3889
-13315
lines changed

README.md

+4-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ PHP version requirement changes in minor releases for SimpleSAMLphp.
3434

3535
### Upgrading?
3636

37-
If you are upgrading from a previous version, checkout the [upgrade guide](UPGRADE.md).
37+
If you are upgrading from a previous version, make sure to check the [upgrade guide](UPGRADE.md).
3838

3939
## Installation
4040

@@ -107,14 +107,12 @@ SimpleSAMLphp configuration file, `config/config.php`.
107107
'oidc' => true,
108108
],
109109

110-
This is required the enable the module on the _Federation_ tab in the admin web interface, which can be used in the
111-
next two steps to finalize the installation.
110+
Once the module is enabled, the database migrations must be run.
112111

113112
### Run database migrations
114113

115114
The module comes with some default SQL migrations which set up needed tables in the configured database. To run them,
116-
open the _Federation_ tab from your _SimpleSAMLphp_ installation and select the option _OpenID Connect Installation_
117-
inside the _Tools_ section. Once there, all you need to do is press the _Install_ button and the schema will be created.
115+
go to `OIDC` > `Database Migrations`, and press the available button.
118116

119117
Alternatively, in case of automatic / scripted deployments, you can run the 'install.php' script from the command line:
120118

@@ -124,8 +122,7 @@ Alternatively, in case of automatic / scripted deployments, you can run the 'ins
124122

125123
The module lets you manage (create, read, update and delete) approved RPs from the module user interface itself.
126124

127-
Once the database schema has been created, you can open the _Federation_ tab from your _SimpleSAMLphp_ installation
128-
and select the option _OpenID Connect Client Registry_ inside the _Tools_ section.
125+
Once the database schema has been created, you can go to `OIDC` > `Client Registry`.
129126

130127
Note that clients can be marked as confidential or public. If the client is not marked as confidential (it is public),
131128
and is using Authorization Code flow, it will have to provide PKCE parameters during the flow.

UPGRADE.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- remove dependency on laminas/laminas-httphandlerrunner
88
- create a bridge towards SSP utility classes, so they can be easily mocked
99
- move away from SSP database as store; move to DBAL
10+
- move to phpstan instead of psalm (as SSP)
1011

1112
# Version 5 to 6
1213

@@ -79,7 +80,12 @@ key `authproc.oidc`
7980

8081
## Low impact changes
8182

82-
Below are some internal changes that should not have impact for the OIDC OP implementors. However, if you are using
83+
In an effort to move to SimpleSAMLphp way of working with user interface (UI), the client management UI was updated
84+
to extend from the SimpleSAMLphp base template. In addition, we have also introduced some configuration overview pages
85+
where you can take a quick view of some of the configuration values for the module. OIDC related pages are now available
86+
from the main SimpleSAMLphp menu in Administration area.
87+
88+
Below are also some internal changes that should not have impact for the OIDC OP implementors. However, if you are using
8389
this module as a library or extending from it, you will probably encounter breaking changes, since a lot of code
8490
has been refactored:
8591

bin/install.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
$database = Database::getInstance();
2323
$databaseMigration = new DatabaseMigration($database);
2424

25-
if ($databaseMigration->isUpdated()) {
25+
if ($databaseMigration->isMigrated()) {
2626
echo 'Database is up to date, skipping.' . PHP_EOL;
2727
return 0;
2828
}

config-templates/module_oidc.php

+10-10
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,13 @@
383383
// Adapter arguments here...
384384
],
385385

386-
// Maximum federation cache item duration. Federation cache item duration will typically be resolved based on the
387-
// expiry of the artifact. For example, when caching entity statements, cache duration will be based on the 'exp'
388-
// claim (expiration time). Since those claims are set by issuer (can be long), it could be desirable to limit
389-
// the maximum time, so that items in cache get refreshed more regularly (and changes propagate more quickly).
390-
// This is only relevant if federation cache adapter is set up. For duration format info, check
391-
// https://www.php.net/manual/en/dateinterval.construct.php.
392-
ModuleConfig::OPTION_FEDERATION_CACHE_MAX_DURATION => 'PT6H', // 6 hours
386+
// Maximum federation cache duration for fetched artifacts. Federation cache duration will typically be resolved
387+
// based on the expiry of the fetched artifact. For example, when caching fetched entity statements, cache
388+
// duration will be based on the 'exp' claim (expiration time). Since those claims are set by issuer (can
389+
// be long), it could be desirable to limit the maximum time, so that items in cache get refreshed more
390+
// regularly (and changes propagate more quickly). This is only relevant if federation cache adapter
391+
// is set up. For duration format info, check https://www.php.net/manual/en/dateinterval.construct.php.
392+
ModuleConfig::OPTION_FEDERATION_CACHE_MAX_DURATION_FOR_FETCHED => 'PT6H', // 6 hours
393393

394394
/**
395395
* PKI settings related to OpenID Federation. These keys will be used, for example, to sign federation
@@ -412,10 +412,10 @@
412412
ModuleConfig::OPTION_FEDERATION_ENTITY_STATEMENT_DURATION => 'P1D', // 1 day
413413

414414
// Cache duration for federation entity statements produced by this OP. This can be used to avoid calculating JWS
415-
// signature on every HTTP request for OP Configuration statement, Subordinate Statements...
416-
// This is only relevant if federation cache adapter is set up. For duration format info, check
415+
// signature on every HTTP request for OP Configuration statement, Subordinate Statements... This is only
416+
// relevant if federation cache adapter is set up. For duration format info, check
417417
// https://www.php.net/manual/en/dateinterval.construct.php.
418-
ModuleConfig::OPTION_FEDERATION_ENTITY_STATEMENT_CACHE_DURATION => 'PT2M', // 2 minutes
418+
ModuleConfig::OPTION_FEDERATION_CACHE_DURATION_FOR_PRODUCED => 'PT2M', // 2 minutes
419419

420420
// Common federation entity parameters:
421421
// https://openid.net/specs/openid-federation-1_0.html#name-common-metadata-parameters

docs/oidc.png

25.5 KB
Loading

hooks/hook_adminmenu.php

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use SimpleSAML\Locale\Translate;
6+
use SimpleSAML\Module\oidc\Codebooks\RoutesEnum;
7+
use SimpleSAML\Module\oidc\ModuleConfig;
8+
use SimpleSAML\XHTML\Template;
9+
10+
/** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection Reference is actually used by SimpleSAMLphp */
11+
function oidc_hook_adminmenu(Template &$template): void
12+
{
13+
$menuKey = 'menu';
14+
15+
if (!isset($template->data[$menuKey]) || !is_array($template->data[$menuKey])) {
16+
return;
17+
}
18+
19+
$moduleConfig = new ModuleConfig();
20+
21+
$oidcMenuEntry = [
22+
ModuleConfig::MODULE_NAME => [
23+
'url' => $moduleConfig->getModuleUrl(RoutesEnum::AdminMigrations->value),
24+
'name' => Translate::noop('OIDC'),
25+
],
26+
];
27+
28+
// Put OIDC entry before the 'Log out' entry, if it exists.
29+
$logoutEntryKey = 'logout';
30+
$logoutEntryValue = null;
31+
if (
32+
array_key_exists($logoutEntryKey, $template->data[$menuKey]) &&
33+
is_array($template->data[$menuKey][$logoutEntryKey])
34+
) {
35+
$logoutEntryValue = $template->data[$menuKey][$logoutEntryKey];
36+
unset($template->data[$menuKey][$logoutEntryKey]);
37+
}
38+
39+
$template->data[$menuKey] += $oidcMenuEntry;
40+
41+
if ($logoutEntryValue !== null) {
42+
$template->data[$menuKey][$logoutEntryKey] = $logoutEntryValue;
43+
}
44+
45+
$template->getLocalization()->addModuleDomain(ModuleConfig::MODULE_NAME);
46+
}

hooks/hook_federationpage.php

+11-5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
use SimpleSAML\Locale\Translate;
1818
use SimpleSAML\Module;
19+
use SimpleSAML\Module\oidc\ModuleConfig;
1920
use SimpleSAML\Module\oidc\Services\DatabaseMigration;
2021
use SimpleSAML\XHTML\Template;
2122

@@ -24,12 +25,17 @@
2425
*/
2526
function oidc_hook_federationpage(Template $template): void
2627
{
27-
$href = Module::getModuleURL('oidc/admin-clients/index.php');
28-
$text = Translate::noop('OpenID Connect Registry');
28+
$routes = new Module\oidc\Utils\Routes(
29+
new ModuleConfig(),
30+
new Module\oidc\Bridges\SspBridge(),
31+
);
2932

30-
if (! (new DatabaseMigration())->isUpdated()) {
31-
$href = Module::getModuleURL('oidc/install.php');
32-
$text = Translate::noop('OpenID Connect Installation');
33+
$href = $routes->urlAdminClients();
34+
$text = Translate::noop('OIDC Client Registry');
35+
36+
if (! (new DatabaseMigration())->isMigrated()) {
37+
$href = $routes->urlAdminMigrations();
38+
$text = Translate::noop('OIDC Installation');
3339
}
3440

3541
if (!is_array($template->data['links'])) {

hooks/hook_frontpage.php

-61
This file was deleted.

public/admin-clients/delete.php

-20
This file was deleted.

public/admin-clients/edit.php

-20
This file was deleted.

public/admin-clients/index.php

-20
This file was deleted.

public/admin-clients/new.php

-20
This file was deleted.

public/admin-clients/reset.php

-20
This file was deleted.

public/admin-clients/show.php

-20
This file was deleted.

public/assets/clipboard/LICENSE

-9
This file was deleted.

0 commit comments

Comments
 (0)