File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed
Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 5353 * Route configuration
5454 */
5555 'route_configuration ' => [
56+ /**
57+ * Enable or disable the login route.
58+ */
59+ 'enabled ' => env ('OIDC_LOGIN_ROUTE_ENABLED ' , true ),
60+
61+ /**
62+ * The url of the login route.
63+ */
5664 'login_route ' => env ('OIDC_LOGIN_ROUTE ' , '/oidc/login ' ),
65+
66+ /**
67+ * The middleware that runs on the login route.
68+ */
5769 'middleware ' => [
5870 'web '
5971 ],
72+
73+ /**
74+ * The prefix of the login route.
75+ */
6076 'prefix ' => '' ,
6177 ]
6278];
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ public function boot(): void
4242
4343 protected function registerRoutes (): void
4444 {
45+ if (!$ this ->routesEnabled ()) {
46+ return ;
47+ }
48+
4549 Route::group ($ this ->routeConfiguration (), function () {
4650 $ this ->loadRoutesFrom (__DIR__ . '/../routes/oidc.php ' );
4751 });
@@ -60,6 +64,21 @@ protected function routeConfiguration(): array
6064 ];
6165 }
6266
67+ /**
68+ * Check in config if the routes are enabled.
69+ *
70+ * @return bool
71+ */
72+ protected function routesEnabled (): bool
73+ {
74+ $ enabled = config ('oidc.route_configuration.enabled ' );
75+ if (!is_bool ($ enabled )) {
76+ return false ;
77+ }
78+
79+ return $ enabled ;
80+ }
81+
6382 protected function registerConfigurationLoader (): void
6483 {
6584 $ this ->app ->singleton (OpenIDConfigurationLoader::class, function (Application $ app ) {
You can’t perform that action at this time.
0 commit comments