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

WIP move to SSP UI #267

Draft
wants to merge 6 commits into
base: wip-version-6
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion bin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$database = Database::getInstance();
$databaseMigration = new DatabaseMigration($database);

if ($databaseMigration->isUpdated()) {
if ($databaseMigration->isMigrated()) {
echo 'Database is up to date, skipping.' . PHP_EOL;
return 0;
}
Expand Down
20 changes: 10 additions & 10 deletions config-templates/module_oidc.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,13 +383,13 @@
// Adapter arguments here...
],

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

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

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

// Common federation entity parameters:
// https://openid.net/specs/openid-federation-1_0.html#name-common-metadata-parameters
Expand Down
46 changes: 46 additions & 0 deletions hooks/hook_adminmenu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

use SimpleSAML\Locale\Translate;
use SimpleSAML\Module\oidc\Codebooks\RoutesEnum;
use SimpleSAML\Module\oidc\ModuleConfig;
use SimpleSAML\XHTML\Template;

/** @noinspection PhpParameterByRefIsNotUsedAsReferenceInspection Reference is actually used by SimpleSAMLphp */
function oidc_hook_adminmenu(Template &$template): void
{
$menuKey = 'menu';

if (!isset($template->data[$menuKey]) || !is_array($template->data[$menuKey])) {
return;
}

$moduleConfig = new ModuleConfig();

$oidcMenuEntry = [
ModuleConfig::MODULE_NAME => [
'url' => $moduleConfig->getModuleUrl(RoutesEnum::AdminConfigProtocol->value),
'name' => Translate::noop('OIDC'),
],
];

// Put OIDC entry before the 'Log out' entry, if it exists.
$logoutEntryKey = 'logout';
$logoutEntryValue = null;
if (
array_key_exists($logoutEntryKey, $template->data[$menuKey]) &&
is_array($template->data[$menuKey][$logoutEntryKey])
) {
$logoutEntryValue = $template->data[$menuKey][$logoutEntryKey];
unset($template->data[$menuKey][$logoutEntryKey]);
}

$template->data[$menuKey] += $oidcMenuEntry;

if ($logoutEntryValue !== null) {
$template->data[$menuKey][$logoutEntryKey] = $logoutEntryValue;
}

$template->getLocalization()->addModuleDomain(ModuleConfig::MODULE_NAME);
}
2 changes: 1 addition & 1 deletion hooks/hook_federationpage.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function oidc_hook_federationpage(Template $template): void
$href = Module::getModuleURL('oidc/admin-clients/index.php');
$text = Translate::noop('OpenID Connect Registry');

if (! (new DatabaseMigration())->isUpdated()) {
if (! (new DatabaseMigration())->isMigrated()) {
$href = Module::getModuleURL('oidc/install.php');
$text = Translate::noop('OpenID Connect Installation');
}
Expand Down
61 changes: 0 additions & 61 deletions hooks/hook_frontpage.php

This file was deleted.

2 changes: 1 addition & 1 deletion public/admin-clients/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\DeleteController;
use SimpleSAML\Module\oidc\Controllers\Client\DeleteController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(DeleteController::class);
2 changes: 1 addition & 1 deletion public/admin-clients/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\EditController;
use SimpleSAML\Module\oidc\Controllers\Client\EditController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(EditController::class);
2 changes: 1 addition & 1 deletion public/admin-clients/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\IndexController;
use SimpleSAML\Module\oidc\Controllers\Client\IndexController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(IndexController::class);
2 changes: 1 addition & 1 deletion public/admin-clients/new.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\CreateController;
use SimpleSAML\Module\oidc\Controllers\Client\CreateController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(CreateController::class);
2 changes: 1 addition & 1 deletion public/admin-clients/reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\ResetSecretController;
use SimpleSAML\Module\oidc\Controllers\Client\ResetSecretController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(ResetSecretController::class);
2 changes: 1 addition & 1 deletion public/admin-clients/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\ShowController;
use SimpleSAML\Module\oidc\Controllers\Client\ShowController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(ShowController::class);
87 changes: 87 additions & 0 deletions public/assets/css/src/default.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.wrap {
/*max-width: 1300px;*/
}

/*h2 {*/
/* margin: 0.3em;*/
/*}*/

h3 {
margin-bottom: 0.5em;
font-size: 1.2em;
font-weight: 600;
color: #1c1c1c;
}

h4 {
margin: 0.4em 0;
font-size: 1.0em;
font-weight: 600;
color: #1c1c1c;
}

/* Container to hold menu and content */
.oidc-container {
display: flex;
max-width: inherit;
margin: 0 auto;
}

/* Style for the left menu */
.menu {
min-width: 200px;
/*background-color: #f4f4f4;*/
/*border-right: solid 1px #bbb;*/
width: auto;
}

/* Style for the menu items */
.menu ul {
list-style-type: none;
padding: 0;
}

.menu ul li {
padding: 0.25rem;
}

.menu ul li a {
text-decoration: none;
color: #333;
display: block;
padding: 0.5rem;
}

.menu ul li a:hover {
background-color: #ddd;
padding: 0.5rem;
}

.menu ul li a.active {
background-color: #eeeeee;
padding: 0.5rem;
}

/* Style for the content area */
.content {
flex-grow: 1;
padding-left: 20px;
max-width: inherit;
background-color: #fff;
}

ul.config {
list-style: disc outside none;
}

/* Text colors */
.black-text { color: black; }
.red-text { color: red; }
.lightcoral-text { color: lightcoral; }
.green-text { color: green; }
.yellow-text { color: yellow; }
.blue-text { color: blue; }
.magenta-text { color: magenta; }
.cyan-text { color: cyan; }
.lightcyan-text { color: lightcyan; }
.white-text { color: white; }
2 changes: 1 addition & 1 deletion public/authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\AuthorizationController;
use SimpleSAML\Module\oidc\Controllers\AuthorizationController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(AuthorizationController::class, false, true);
2 changes: 1 addition & 1 deletion public/clients/delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\DeleteController;
use SimpleSAML\Module\oidc\Controllers\Client\DeleteController;
use SimpleSAML\Module\oidc\Services\AuthContextService;
use SimpleSAML\Module\oidc\Services\RoutingService;

Expand Down
2 changes: 1 addition & 1 deletion public/clients/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\EditController;
use SimpleSAML\Module\oidc\Controllers\Client\EditController;
use SimpleSAML\Module\oidc\Services\AuthContextService;
use SimpleSAML\Module\oidc\Services\RoutingService;

Expand Down
2 changes: 1 addition & 1 deletion public/clients/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\IndexController;
use SimpleSAML\Module\oidc\Controllers\Client\IndexController;
use SimpleSAML\Module\oidc\Services\AuthContextService;
use SimpleSAML\Module\oidc\Services\RoutingService;

Expand Down
2 changes: 1 addition & 1 deletion public/clients/new.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\CreateController;
use SimpleSAML\Module\oidc\Controllers\Client\CreateController;
use SimpleSAML\Module\oidc\Services\AuthContextService;
use SimpleSAML\Module\oidc\Services\RoutingService;

Expand Down
2 changes: 1 addition & 1 deletion public/clients/reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\ResetSecretController;
use SimpleSAML\Module\oidc\Controllers\Client\ResetSecretController;
use SimpleSAML\Module\oidc\Services\AuthContextService;
use SimpleSAML\Module\oidc\Services\RoutingService;

Expand Down
2 changes: 1 addition & 1 deletion public/clients/show.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\Client\ShowController;
use SimpleSAML\Module\oidc\Controllers\Client\ShowController;
use SimpleSAML\Module\oidc\Services\AuthContextService;
use SimpleSAML\Module\oidc\Services\RoutingService;

Expand Down
2 changes: 1 addition & 1 deletion public/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\InstallerController;
use SimpleSAML\Module\oidc\Controllers\InstallerController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(InstallerController::class);
2 changes: 1 addition & 1 deletion public/jwks.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\JwksController;
use SimpleSAML\Module\oidc\Controllers\JwksController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(JwksController::class, false, true);
2 changes: 1 addition & 1 deletion public/logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* file that was distributed with this source code.
*/

use SimpleSAML\Module\oidc\Controller\EndSessionController;
use SimpleSAML\Module\oidc\Controllers\EndSessionController;
use SimpleSAML\Module\oidc\Services\RoutingService;

RoutingService::call(EndSessionController::class, false, true);
Loading