Commit c22d5dc209a2f39553ad9f9ac2588a4e3355df47

Authored by Chris Bellas
1 parent e33705c67b

Enable/disable authentication middleware dynamically

Showing 2 changed files with 6 additions and 4 deletions

api/.env.example View file @ c22d5dc
... ... @@ -54,4 +54,6 @@
54 54 OD_GRAFANA_PARAMS=/d/qDDyJZ6Wz/od?orgId=1
55 55 MLTD_GRAFANA_PARAMS=/d/dtCrgk6Wk/mltd?orgId=1
56 56 CEPTD_KIBANA_PARAMS="/app/kibana#/dashboard/Suricata?_g=(refreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-15m%2Cto%3Anow))"
  57 +
  58 +AUTH_ENABLED=false
api/routes/api.php View file @ c22d5dc
... ... @@ -13,7 +13,9 @@
13 13 |
14 14 */
15 15  
16   -//Route::group(['middleware' => 'auth:api'], function () {
  16 +$parameters = env('AUTH_ENABLED') ? ['middleware' => 'auth:api'] : [];
  17 +
  18 +Route::group($parameters, function () {
17 19 Route::get('config', 'ConfigController@index');
18 20 Route::get('capec', 'CapecController@index');
19 21 Route::group(['prefix' => 'v1'], function () {
... ... @@ -35,7 +37,7 @@
35 37 Route::get('events/group','V1\Components\MltdController@group');
36 38 Route::get('events/last','V1\Components\MltdController@last');
37 39 //should be last since matches to anything */*
38   - Route::get('{train_id}/{top}', 'V1\Components\MltdController@train');
  40 + Route::get('{train_id}/{top}', 'V1\Components\MltdController@train');
39 41 });
40 42 Route::group(['prefix' => 'od'], function () {
41 43 Route::get('start', 'V1\Components\OdController@start');
... ... @@ -47,6 +49,5 @@
47 49 Route::get('events/last','V1\Components\OdController@last');
48 50 });
49 51 });
50   -
51   -//});
  52 +});