diff --git a/.env.example b/.env.example index d0a1dbb26..110b36500 100644 --- a/.env.example +++ b/.env.example @@ -50,6 +50,10 @@ OKTA_BASE_URL=false OKTA_APP_ID=false OKTA_APP_SECRET=false +GITLAB_APP_ID=false +GITLAB_APP_SECRET=false +GITLAB_BASE_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/composer.lock b/composer.lock index 9db080bab..f36355797 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "8ad5cb7acc1115a77404d1be899984ac", + "content-hash": "210685bb4ecd91f015682f5cf03ba84d", "packages": [ { "name": "aws/aws-sdk-php", @@ -2075,6 +2075,43 @@ ], "time": "2016-07-19T19:14:21+00:00" }, + { + "name": "socialiteproviders/gitlab", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/SocialiteProviders/GitLab.git", + "reference": "c96dc004563a3caf157608fe9aa9e45c79065d00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SocialiteProviders/GitLab/zipball/c96dc004563a3caf157608fe9aa9e45c79065d00", + "reference": "c96dc004563a3caf157608fe9aa9e45c79065d00", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "socialiteproviders/manager": "~3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "SocialiteProviders\\GitLab\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christoffer Martinsen", + "email": "christoffermartinsen@gmail.com" + } + ], + "description": "GitLab OAuth2 Provider for Laravel Socialite", + "time": "2017-01-31T05:06:13+00:00" + }, { "name": "socialiteproviders/manager", "version": "v3.3.0", diff --git a/config/services.php b/config/services.php index 18649c093..31d5a09cf 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_APP_ID'), + 'client_secret' => env('GITLAB_APP_SECRET'), + 'redirect' => env('APP_URL') . '/login/service/gitlab/callback', + 'instance_uri' => env('GITLAB_BASE_URI'), // needs only for GitLab self hosted + 'name' => 'Gitlab', + ], 'ldap' => [ 'server' => env('LDAP_SERVER', false), diff --git a/resources/assets/icons/gitlab.svg b/resources/assets/icons/gitlab.svg new file mode 100644 index 000000000..fa1e92a56 --- /dev/null +++ b/resources/assets/icons/gitlab.svg @@ -0,0 +1 @@ +