Skip to content

Commit

Permalink
Refactor site sets
Browse files Browse the repository at this point in the history
  • Loading branch information
r3h6 committed Oct 19, 2024
1 parent d6b18b2 commit 94b02e3
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 27 deletions.
16 changes: 11 additions & 5 deletions Classes/Middleware/Initializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,23 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
return $handler->handle($request);
}

$siteConfiguration = $site->getConfiguration()['oauth2'] ?? [];
$siteSettings = $site->getSettings()->get('oauth2_server') ?? [];
if ($siteConfiguration === [] && $siteSettings === []) {
$siteConfiguration = $site->getConfiguration()['oauth2'] ?? false;
$siteSettings = $site->getSettings()->get('oauth2_server') ?? false;
if ($siteConfiguration === false && $siteSettings === false) {
return $handler->handle($request);
}

$this->logger->debug('Configure oauth2 server', $this->configuration->toArray());

$this->configuration->merge($this->extensionConfiguration->get('oauth2_server'));
$this->configuration->merge($siteConfiguration);
$this->configuration->merge($siteSettings);

if ($siteConfiguration !== false) {
$this->configuration->merge($siteConfiguration);
}

if ($siteSettings !== false) {
$this->configuration->merge($siteSettings);
}

if ($this->configuration->isEnabled() === false) {
return $handler->handle($request);
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Sets/Configuration/config.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: oauth2-server/configuration
label: OAuth2 Server Configuration
label: "OAuth2 Server: Configuration Only"
10 changes: 5 additions & 5 deletions Configuration/Sets/Configuration/settings.definitions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ settings:
oauth2_server.routePrefix:
label: 'Authorization server route prefix'
category: OAuth2Server.configuration
description: ''
description: 'Defaults to "oauth2"'
type: string
default: ''
oauth2_server.accessTokensExpireIn:
label: 'Access token TTL'
category: OAuth2Server.configuration
description: ''
description: 'Defaults to "PT1H" (1 hour)'
type: string
default: ''
oauth2_server.refreshTokensExpireIn:
label: 'Refresh token TTL'
category: OAuth2Server.configuration
description: ''
description: 'Defaults to "P1M" (1 month)'
type: string
default: ''
oauth2_server.requireCodeChallengeForPublicClients:
Expand All @@ -63,14 +63,14 @@ settings:
oauth2_server.scopes:
label: 'Scopes'
category: OAuth2Server.configuration
description: ''
description: 'Configurable only directly in the yaml file'
type: stringlist
default: ''
readonly: true
oauth2_server.resources:
label: 'Resources'
category: OAuth2Server.configuration
description: ''
description: 'Configurable only directly in the yaml file'
type: stringlist
default: ''
readonly: true
7 changes: 0 additions & 7 deletions Configuration/Sets/IdentitityProvider/config.yaml

This file was deleted.

6 changes: 6 additions & 0 deletions Configuration/Sets/Template/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: oauth2-server/template
label: "OAuth2 Server: IdP Template"

dependencies:
- typo3/fluid-styled-content
- typo3/felogin
File renamed without changes.
16 changes: 12 additions & 4 deletions Documentation/QuickStart/Configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ Quick configuration
===================


TYPO3 v13
=========

1. Create your own `public and private keys<https://oauth2.thephpleague.com/installation/#generating-public-and-private-keys>`__.
Change the permissions of the keys to :code:`600` or :code:`660`

2. Include site sets and configure settings


TYPO3 v12
=========

1. Create your own `public and private keys<https://oauth2.thephpleague.com/installation/#generating-public-and-private-keys>`__.
Change the permissions of the keys to :code:`600` or :code:`660`

Expand All @@ -31,7 +43,3 @@ Quick configuration
oauth2_server:
resources:
- 'EXT:my_extension/Configuration/Yaml/Routes.yaml'
.. note::

In TYPO3 v13 you can do most configuration directly within site set settings.
2 changes: 1 addition & 1 deletion Documentation/QuickStart/Integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ Create this page as "Folder" and add your client records.
Setup template
==============

Include the TypoScript template provided by this extension or use the site set in TYPO3 v13.
Include the TypoScript template provided by this extension or use the site sets in TYPO3 v13.
25 changes: 22 additions & 3 deletions Documentation/Upgrade/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,26 @@
Upgrade from 1.x to 2.x
=======================


Breaking changes
================


Library updates
---------------

The library ``league/oauth2-server`` has been updated to version ``9.*``.


Resource routes
===============
---------------

The configuration and registration of resource routes has changed.
Configuration is now done in YAML files. See section ":ref:`resourceRoutes`".


Simplified middleware stack
===========================
---------------------------

The middleware stack has been simplified. The middleware stack is now:

Expand All @@ -26,7 +37,15 @@ The middleware stack has been simplified. The middleware stack is now:
#. :txt:`r3h6/oauth2-server/dispatcher`
#. ...


Removed class ExtbaseGuard
==========================
--------------------------

Check the attributes on the request object instead.


Deprecations
============

Configuration in site `config.yaml` under the key `oauth2` is condsidered deprecated.
Use site `settings.yaml` instead under the key `oauth2_server`.
3 changes: 2 additions & 1 deletion config/sites/main/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
base: 'https://typo3-oauth2-server.ddev.site/'
dependencies:
- oauth2-server/identity-provider
- oauth2-server/template
- oauth2-server/configuration
languages:
-
title: English
Expand Down

0 comments on commit 94b02e3

Please sign in to comment.