Skip to content

Commit 65a8372

Browse files
committed
Merge branch 'develop'
2 parents 640ed02 + 8e3bcfd commit 65a8372

26 files changed

+498
-488
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,19 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [1.5.0] - 2023-10-26
8+
9+
- [#167](https://github.com/os2display/display-api-service/pull/167)
10+
- Removed references to non-existing exception.
11+
- [#166](https://github.com/os2display/display-api-service/pull/166)
12+
- Wrapped feeds in try-catch to avoid throwing errors.
13+
- Added unpublished flow to EventDatabase feed when occurrence returns 404.
14+
- Fixed EventDatabase feed poster subscription parameters not being applied when calling getData().
15+
- [#163](https://github.com/os2display/display-api-service/pull/163)
16+
- Upgraded `itk-dev/openid-connect-bundle` to use code authorization flow. Updated OpenAPI spec accordingly.
17+
718
## [1.4.0] - 2023-09-14
19+
820
- [#160](https://github.com/os2display/display-api-service/pull/160)
921
Added app:feed:list-feed-source command. Removed listing from app:feed:remove-feed-source command.
1022
- [#159](https://github.com/os2display/display-api-service/pull/159)

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You can now obtain a token by sending a `POST` request to the
6161

6262
```curl
6363
curl -X 'POST' \
64-
'http://displayapiservice.local.itkdev.dk/authentication/token' \
64+
'http://displayapiservice.local.itkdev.dk/v1/authentication/token' \
6565
-H 'accept: application/json' \
6666
-H 'Content-Type: application/json' \
6767
-d '{
@@ -159,4 +159,4 @@ act -P ubuntu-latest=shivammathur/node:latest pull_request
159159

160160
We use [SemVer](http://semver.org/) for versioning.
161161
For the versions available, see the
162-
[tags on this repository](https://github.com/itk-dev/openid-connect/tags).
162+
[tags on this repository](https://github.com/os2display/display-api-service/tags).

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"doctrine/doctrine-migrations-bundle": "^3.1",
1818
"doctrine/orm": "^2.9",
1919
"gesdinet/jwt-refresh-token-bundle": "^1.0",
20-
"itk-dev/openid-connect-bundle": "^2.0",
20+
"itk-dev/openid-connect-bundle": "^3.0",
2121
"justinrainbow/json-schema": "^5.2",
2222
"kubawerlos/php-cs-fixer-custom-fixers": "^3.11",
2323
"lexik/jwt-authentication-bundle": "^2.14",

composer.lock

+27-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/packages/itkdev_openid_connect.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ itkdev_openid_connect:
22
cache_options:
33
cache_pool: 'cache.app' # Cache item pool for caching discovery document and CLI login tokens
44
cli_login_options:
5-
cli_redirect: '%env(CLI_REDIRECT)%' # Redirect route for CLI login
5+
route: '%env(CLI_REDIRECT)%' # Redirect route for CLI login
66
openid_providers:
77
# Define one or more providers
88
# [providerKey]:

public/api-spec-v1.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
],
2424
"responses": {
2525
"200": {
26-
"description": "Get JWT token from OIDC token",
26+
"description": "Get JWT token from OIDC code",
2727
"content": {
2828
"application/json": {
2929
"schema": {
@@ -33,7 +33,7 @@
3333
}
3434
}
3535
},
36-
"summary": "Get JWT token to login from OIDC token",
36+
"summary": "Get JWT token to login from OIDC code",
3737
"description": "",
3838
"parameters": [
3939
{
@@ -47,8 +47,8 @@
4747
}
4848
},
4949
{
50-
"name": "id_token",
51-
"description": "OIDC id token",
50+
"name": "code",
51+
"description": "OIDC code",
5252
"in": "query",
5353
"required": false,
5454
"example": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",

public/api-spec-v1.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ paths:
1717
- Authentication
1818
responses:
1919
200:
20-
description: 'Get JWT token from OIDC token'
20+
description: 'Get JWT token from OIDC code'
2121
content:
2222
application/json:
2323
schema:
2424
$ref: '#/components/schemas/Token'
25-
summary: 'Get JWT token to login from OIDC token'
25+
summary: 'Get JWT token to login from OIDC code'
2626
description: ''
2727
parameters:
2828
-
@@ -34,8 +34,8 @@ paths:
3434
schema:
3535
type: string
3636
-
37-
name: id_token
38-
description: 'OIDC id token'
37+
name: code
38+
description: 'OIDC code'
3939
in: query
4040
required: false
4141
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

src/Command/User/AddUserCommand.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,11 @@ protected function initialize(InputInterface $input, OutputInterface $output): v
111111
*/
112112
protected function interact(InputInterface $input, OutputInterface $output): void
113113
{
114-
if (null !== $input->getArgument('email') &&
115-
null !== $input->getArgument('password') &&
116-
null !== $input->getArgument('full-name') &&
117-
null !== $input->getArgument('role') &&
118-
null !== $input->getArgument('tenant-keys')
114+
if (null !== $input->getArgument('email')
115+
&& null !== $input->getArgument('password')
116+
&& null !== $input->getArgument('full-name')
117+
&& null !== $input->getArgument('role')
118+
&& null !== $input->getArgument('tenant-keys')
119119
) {
120120
return;
121121
}

src/Controller/AuthOidcController.php

+7-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(
3232
#[Route('/v1/authentication/oidc/token', name: 'authentication_oidc_token', methods: ['GET'])]
3333
public function getToken(Request $request): Response
3434
{
35-
if ($request->query->has('state') && $request->query->has('id_token')) {
35+
if ($request->query->has('state') && $request->query->has('code')) {
3636
try {
3737
$passport = $this->oidcAuthenticator->authenticate($request);
3838

@@ -71,7 +71,12 @@ public function getUrls(Request $request, SessionInterface $session): Response
7171
$session->set('oauth2nonce', $nonce);
7272

7373
$data = [
74-
'authorizationUrl' => $provider->getAuthorizationUrl(['state' => $state, 'nonce' => $nonce]),
74+
'authorizationUrl' => $provider->getAuthorizationUrl([
75+
'state' => $state,
76+
'nonce' => $nonce,
77+
'response_type' => 'code',
78+
'scope' => 'openid email profile',
79+
]),
7580
'endSessionUrl' => $provider->getEndSessionUrl(),
7681
];
7782

src/DataProvider/FeedDataProvider.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use ApiPlatform\Core\DataProvider\RestrictedDataProviderInterface;
88
use App\Entity\Tenant\Feed;
99
use App\Entity\User;
10-
use App\Exceptions\MissingFeedConfigurationException;
1110
use App\Repository\FeedRepository;
1211
use App\Repository\PlaylistSlideRepository;
1312
use App\Service\FeedService;
@@ -19,7 +18,6 @@
1918
use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface;
2019
use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
2120
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
22-
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
2321

2422
final class FeedDataProvider implements ItemDataProviderInterface, RestrictedDataProviderInterface
2523
{
@@ -58,7 +56,7 @@ public function getItem(string $resourceClass, $id, string $operationName = null
5856
// Get result. If there is a result this is returned.
5957
try {
6058
$feed = $queryBuilder->getQuery()->getOneOrNullResult();
61-
} catch (NonUniqueResultException $exception) {
59+
} catch (NonUniqueResultException) {
6260
return null;
6361
}
6462

@@ -91,12 +89,10 @@ public function getItem(string $resourceClass, $id, string $operationName = null
9189
if ('get' === $operationName || 'get_feed_data' === $operationName) {
9290
return new JsonResponse($this->feedService->getData($feed), 200);
9391
}
94-
} catch (MissingFeedConfigurationException $e) {
95-
$this->logger->error(sprintf('Missing configuration for feed with id "%s" with message "%s"', $feed->getId()->jsonSerialize(), $e->getMessage()));
96-
} catch (\JsonException $e) {
97-
$this->logger->error(sprintf('JSON decode for feed with id "%s" with error "%s"', $feed->getId()->jsonSerialize(), $e->getMessage()));
98-
} catch (ClientExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface|TransportExceptionInterface $e) {
92+
} catch (ClientExceptionInterface|RedirectionExceptionInterface|ServerExceptionInterface $e) {
9993
$this->logger->error(sprintf('Communication error "%s"', $e->getMessage()));
94+
} catch (\Throwable $e) {
95+
$this->logger->error(sprintf('Feed data error. ID: %s, MESSAGE: %s', $feed->getId()->jsonSerialize(), $e->getMessage()));
10096
}
10197
}
10298

src/Entity/Tenant/Media.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function setSha(string $sha): self
138138
return $this;
139139
}
140140

141-
public function setFile(?File $file = null): self
141+
public function setFile(File $file = null): self
142142
{
143143
$this->file = $file;
144144

src/Exceptions/MissingFeedConfigurationException.php

-7
This file was deleted.

0 commit comments

Comments
 (0)