Skip to content

Commit c18fe7b

Browse files
authored
[9.x] Fixed grouping for user authorization (#42664)
* Fixed grouping for user authorization * Add new method to avoid BC.
1 parent e988f0f commit c18fe7b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/Illuminate/Broadcasting/BroadcastManager.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,42 @@ public function routes(array $attributes = null)
7474
['get', 'post'], '/broadcasting/auth',
7575
'\\'.BroadcastController::class.'@authenticate'
7676
)->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
77+
});
78+
}
79+
80+
/**
81+
* Register the routes for handling broadcast authentication.
82+
*
83+
* @param array|null $attributes
84+
* @return void
85+
*/
86+
public function userAuthenticationRoutes(array $attributes = null)
87+
{
88+
if ($this->app instanceof CachesRoutes && $this->app->routesAreCached()) {
89+
return;
90+
}
7791

92+
$attributes = $attributes ?: ['middleware' => ['web']];
93+
94+
$this->app['router']->group($attributes, function ($router) {
7895
$router->match(
7996
['get', 'post'], '/broadcasting/user-auth',
8097
'\\'.BroadcastController::class.'@authenticateUser'
8198
)->withoutMiddleware([\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::class]);
8299
});
83100
}
84101

102+
/**
103+
* Alias for routes().
104+
*
105+
* @param array|null $attributes
106+
* @return void
107+
*/
108+
public function channelAuthorizationRoutes(array $attributes = null)
109+
{
110+
return $this->routes($attributes);
111+
}
112+
85113
/**
86114
* Get the socket ID for the given request.
87115
*

0 commit comments

Comments
 (0)