Skip to content

Commit b69efd4

Browse files
committed
Fix deprecation
Replace deprecated dispatchNow with dispatchSync. Thanks @will-dive for this catch. Signed-off-by: Jesse Vista <jvista@upwebdesign.com>
1 parent 7151ba7 commit b69efd4

3 files changed

Lines changed: 19 additions & 10 deletions

File tree

src/Http/Controllers/LogoutController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace CodeGreenCreative\SamlIdp\Http\Controllers;
44

5+
use Illuminate\Support\Str;
6+
use Illuminate\Http\Request;
57
use Illuminate\Routing\Controller;
68
use CodeGreenCreative\SamlIdp\Jobs\SamlSlo;
7-
use Illuminate\Http\Request;
8-
use Illuminate\Support\Str;
99

1010
class LogoutController extends Controller
1111
{
@@ -29,10 +29,10 @@ public function index(Request $request)
2929
// Loop through our service providers and "touch" the logout URL's
3030
foreach (config('samlidp.sp') as $key => $sp) {
3131
// Check if the service provider supports SLO
32-
if (! empty($sp['logout']) && ! in_array($key, $request->session()->get('saml.slo', []))) {
32+
if (!empty($sp['logout']) && !in_array($key, $request->session()->get('saml.slo', []))) {
3333
// Push this SP onto the saml slo array
3434
$request->session()->push('saml.slo', $key);
35-
return redirect(SamlSlo::dispatchNow($sp));
35+
return redirect(SamlSlo::dispatchSync($sp));
3636
}
3737
}
3838

src/Listeners/SamlAuthenticated.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace CodeGreenCreative\SamlIdp\Listeners;
44

5-
use CodeGreenCreative\SamlIdp\Jobs\SamlSso;
65
use Illuminate\Auth\Events\Authenticated;
6+
use CodeGreenCreative\SamlIdp\Jobs\SamlSso;
77

88
class SamlAuthenticated
99
{
@@ -15,8 +15,13 @@ class SamlAuthenticated
1515
*/
1616
public function handle(Authenticated $event)
1717
{
18-
if (in_array($event->guard, config('samlidp.guards')) && request()->filled('SAMLRequest') && ! request()->is('saml/logout') && request()->isMethod('get')) {
19-
abort(response(SamlSso::dispatchNow($event->guard)), 302);
18+
if (
19+
in_array($event->guard, config('samlidp.guards')) &&
20+
request()->filled('SAMLRequest') &&
21+
!request()->is('saml/logout') &&
22+
request()->isMethod('get')
23+
) {
24+
abort(response(SamlSso::dispatchSync($event->guard)), 302);
2025
}
2126
}
2227
}

src/Listeners/SamlLogin.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace CodeGreenCreative\SamlIdp\Listeners;
44

5-
use CodeGreenCreative\SamlIdp\Jobs\SamlSso;
65
use Illuminate\Auth\Events\Login;
6+
use CodeGreenCreative\SamlIdp\Jobs\SamlSso;
77

88
class SamlLogin
99
{
@@ -15,8 +15,12 @@ class SamlLogin
1515
*/
1616
public function handle(Login $event)
1717
{
18-
if (in_array($event->guard, config('samlidp.guards')) && request()->filled('SAMLRequest') && ! request()->is('saml/logout')) {
19-
abort(response(SamlSso::dispatchNow($event->guard)), 302);
18+
if (
19+
in_array($event->guard, config('samlidp.guards')) &&
20+
request()->filled('SAMLRequest') &&
21+
!request()->is('saml/logout')
22+
) {
23+
abort(response(SamlSso::dispatchSync($event->guard)), 302);
2024
}
2125
}
2226
}

0 commit comments

Comments
 (0)