Skip to content

Commit 93bcbd1

Browse files
committed
Merge branch 'v25-11' into release
2 parents 46001d6 + 65f7b61 commit 93bcbd1

File tree

10 files changed

+387
-308
lines changed

10 files changed

+387
-308
lines changed

app/Access/Controllers/OidcController.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99

1010
class OidcController extends Controller
1111
{
12-
protected OidcService $oidcService;
13-
14-
public function __construct(OidcService $oidcService)
15-
{
16-
$this->oidcService = $oidcService;
12+
public function __construct(
13+
protected OidcService $oidcService
14+
) {
1715
$this->middleware('guard:oidc');
1816
}
1917

@@ -30,7 +28,7 @@ public function login()
3028
return redirect('/login');
3129
}
3230

33-
session()->flash('oidc_state', $loginDetails['state']);
31+
session()->put('oidc_state', time() . ':' . $loginDetails['state']);
3432

3533
return redirect($loginDetails['url']);
3634
}
@@ -41,10 +39,16 @@ public function login()
4139
*/
4240
public function callback(Request $request)
4341
{
44-
$storedState = session()->pull('oidc_state');
4542
$responseState = $request->query('state');
43+
$splitState = explode(':', session()->pull('oidc_state', ':'), 2);
44+
if (count($splitState) !== 2) {
45+
$splitState = [null, null];
46+
}
47+
48+
[$storedStateTime, $storedState] = $splitState;
49+
$threeMinutesAgo = time() - 3 * 60;
4650

47-
if ($storedState !== $responseState) {
51+
if (!$storedState || $storedState !== $responseState || intval($storedStateTime) < $threeMinutesAgo) {
4852
$this->showErrorNotification(trans('errors.oidc_fail_authed', ['system' => config('oidc.name')]));
4953

5054
return redirect('/login');
@@ -62,7 +66,7 @@ public function callback(Request $request)
6266
}
6367

6468
/**
65-
* Log the user out then start the OIDC RP-initiated logout process.
69+
* Log the user out, then start the OIDC RP-initiated logout process.
6670
*/
6771
public function logout()
6872
{

app/Http/Middleware/StartSessionExtended.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
class StartSessionExtended extends Middleware
1515
{
1616
protected static array $pathPrefixesExcludedFromHistory = [
17-
'uploads/images/'
17+
'uploads/images/',
18+
'dist/',
19+
'manifest.json',
20+
'opensearch.xml',
1821
];
1922

2023
/**

0 commit comments

Comments
 (0)