From 44d8f39037dfc23520fd2b0698785b148dd8c512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Balu=CC=81n?= Date: Wed, 31 Jan 2018 16:02:07 +0100 Subject: [PATCH] add support for gitlab authentification --- .env.example | 6 +++++- app/Providers/EventServiceProvider.php | 1 + app/Services/SocialAuthService.php | 2 +- composer.json | 3 ++- config/services.php | 10 +++++++++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index ddb32c0bc..279d0f5e9 100644 --- a/.env.example +++ b/.env.example @@ -50,6 +50,10 @@ OKTA_BASE_URL=false OKTA_KEY=false OKTA_SECRET=false +GITLAB_KEY=false +GITLAB_SECRET=false +GITLAB_INSTANCE_URI=false + # External services such as Gravatar DISABLE_EXTERNAL_SERVICES=false @@ -67,4 +71,4 @@ MAIL_HOST=localhost MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null -MAIL_ENCRYPTION=null \ No newline at end of file +MAIL_ENCRYPTION=null diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 05f9c57c1..dec7b98c6 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -18,6 +18,7 @@ class EventServiceProvider extends ServiceProvider 'SocialiteProviders\Slack\SlackExtendSocialite@handle', 'SocialiteProviders\Azure\AzureExtendSocialite@handle', 'SocialiteProviders\Okta\OktaExtendSocialite@handle', + 'SocialiteProviders\GitLab\GitLabExtendSocialite@handle', ], ]; diff --git a/app/Services/SocialAuthService.php b/app/Services/SocialAuthService.php index 30f7eed0e..c31e67d0d 100644 --- a/app/Services/SocialAuthService.php +++ b/app/Services/SocialAuthService.php @@ -16,7 +16,7 @@ class SocialAuthService protected $socialite; protected $socialAccount; - protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta']; + protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta', 'gitlab']; /** * SocialAuthService constructor. diff --git a/composer.json b/composer.json index 2750b7cb3..10b3592c8 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "barryvdh/laravel-snappy": "^0.4.0", "socialiteproviders/slack": "^3.0", "socialiteproviders/microsoft-azure": "^3.0", - "socialiteproviders/okta": "^1.0" + "socialiteproviders/okta": "^1.0", + "socialiteproviders/gitlab": "^3.0" }, "require-dev": { "filp/whoops": "~2.0", diff --git a/config/services.php b/config/services.php index 18649c093..17f54ab45 100644 --- a/config/services.php +++ b/config/services.php @@ -92,7 +92,15 @@ return [ 'redirect' => env('APP_URL') . '/login/service/okta/callback', 'base_url' => env('OKTA_BASE_URL'), 'name' => 'Okta', - ], + ], + + 'gitlab' => [ + 'client_id' => env('GITLAB_KEY'), + 'client_secret' => env('GITLAB_SECRET'), + 'redirect' => env('APP_URL') . '/login/service/gitlab/callback', + 'instance_uri' => env('GITLAB_INSTANCE_URI'), // needs only for GitLab self hosted + 'name' => 'Gitlab', + ], 'ldap' => [ 'server' => env('LDAP_SERVER', false),