From 732f777c753690043d34e8fa762324bfc21812c0 Mon Sep 17 00:00:00 2001 From: Deon George Date: Fri, 7 Mar 2025 08:20:20 +1100 Subject: [PATCH] Rename our configuration keys to ldap/ldaps/startls, they are not openldap specific --- app/Http/Middleware/SwapinAuthUser.php | 3 +++ config/ldap.php | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Http/Middleware/SwapinAuthUser.php b/app/Http/Middleware/SwapinAuthUser.php index 9a07a449..aef7e95f 100644 --- a/app/Http/Middleware/SwapinAuthUser.php +++ b/app/Http/Middleware/SwapinAuthUser.php @@ -25,6 +25,9 @@ class SwapinAuthUser { $key = config('ldap.default'); + if (! array_key_exists($key,config('ldap.connections'))) + abort(599,sprintf('LDAP default server [%s] configuration doesnt exist?',$key)); + /* // Rebuild our connection with the authenticated user. if (Session::has('username_encrypt') && Session::has('password_encrypt')) { diff --git a/config/ldap.php b/config/ldap.php index 07dff22b..c41ed84e 100644 --- a/config/ldap.php +++ b/config/ldap.php @@ -15,7 +15,7 @@ return [ | */ - 'default' => env('LDAP_CONNECTION', 'openldap'), + 'default' => env('LDAP_CONNECTION', 'ldap'), /* |-------------------------------------------------------------------------- @@ -30,7 +30,7 @@ return [ 'connections' => [ - 'openldap' => [ + 'ldap' => [ 'hosts' => [env('LDAP_HOST', '127.0.0.1')], 'username' => env('LDAP_USERNAME', 'cn=user,dc=local,dc=com'), 'password' => env('LDAP_PASSWORD', 'secret'), @@ -42,7 +42,7 @@ return [ 'name' => env('LDAP_NAME','LDAP Server'), ], - 'openldaps' => [ + 'ldaps' => [ 'hosts' => [env('LDAP_HOST', '127.0.0.1')], 'username' => env('LDAP_USERNAME', 'cn=user,dc=local,dc=com'), 'password' => env('LDAP_PASSWORD', 'secret'), @@ -54,7 +54,7 @@ return [ 'name' => env('LDAP_NAME','LDAPS Server'), ], - 'openldaptls' => [ + 'starttls' => [ 'hosts' => [env('LDAP_HOST', '127.0.0.1')], 'username' => env('LDAP_USERNAME', 'cn=user,dc=local,dc=com'), 'password' => env('LDAP_PASSWORD', 'secret'), @@ -66,6 +66,7 @@ return [ 'name' => env('LDAP_NAME','LDAP-TLS Server'), ], + /* 'opendj' => [ 'hosts' => ['opendj'], 'username' => 'cn=Directory Manager', @@ -77,6 +78,7 @@ return [ 'use_tls' => env('LDAP_TLS', false), 'name' => 'OpenDJ Server', ], + */ ], @@ -174,4 +176,4 @@ return [ ] ], ], -]; \ No newline at end of file +];