From 009af9736e8c52710de6764eb159909236c2b3a8 Mon Sep 17 00:00:00 2001 From: Timo Bartholomes Date: Sun, 26 Nov 2017 16:41:29 +0100 Subject: [PATCH] Add socialite authentication for okta --- .env.example | 3 ++ app/Providers/EventServiceProvider.php | 1 + app/Services/SocialAuthService.php | 2 +- composer.json | 3 +- composer.lock | 39 +++++++++++++++++++++++++- config/services.php | 8 ++++++ resources/assets/icons/okta.svg | 1 + 7 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 resources/assets/icons/okta.svg diff --git a/.env.example b/.env.example index e44a46ef3..ddb32c0bc 100644 --- a/.env.example +++ b/.env.example @@ -46,6 +46,9 @@ GITHUB_APP_ID=false GITHUB_APP_SECRET=false GOOGLE_APP_ID=false GOOGLE_APP_SECRET=false +OKTA_BASE_URL=false +OKTA_KEY=false +OKTA_SECRET=false # External services such as Gravatar DISABLE_EXTERNAL_SERVICES=false diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index ac4e7bc35..05f9c57c1 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -17,6 +17,7 @@ class EventServiceProvider extends ServiceProvider SocialiteWasCalled::class => [ 'SocialiteProviders\Slack\SlackExtendSocialite@handle', 'SocialiteProviders\Azure\AzureExtendSocialite@handle', + 'SocialiteProviders\Okta\OktaExtendSocialite@handle', ], ]; diff --git a/app/Services/SocialAuthService.php b/app/Services/SocialAuthService.php index 6d5b401d1..6286a6014 100644 --- a/app/Services/SocialAuthService.php +++ b/app/Services/SocialAuthService.php @@ -14,7 +14,7 @@ class SocialAuthService protected $socialite; protected $socialAccount; - protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure']; + protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta']; /** * SocialAuthService constructor. diff --git a/composer.json b/composer.json index 99344b88b..c86af0f45 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ "gathercontent/htmldiff": "^0.2.1", "barryvdh/laravel-snappy": "^0.4.0", "socialiteproviders/slack": "^3.0", - "socialiteproviders/microsoft-azure": "^3.0" + "socialiteproviders/microsoft-azure": "^3.0", + "socialiteproviders/okta": "^1.0" }, "require-dev": { "filp/whoops": "~2.0", diff --git a/composer.lock b/composer.lock index 7472d083a..f52a2022b 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": "7aa47303355cad47ffc59a24bcce2b1a", + "content-hash": "384c1805a51b16b9304ab3ac58f9554d", "packages": [ { "name": "aws/aws-sdk-php", @@ -2161,6 +2161,43 @@ "description": "Microsoft Azure OAuth2 Provider for Laravel Socialite", "time": "2017-01-25T09:48:29+00:00" }, + { + "name": "socialiteproviders/okta", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/SocialiteProviders/Okta.git", + "reference": "dcda13432c80060cd84d4cb5f2af422d280ab895" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/SocialiteProviders/Okta/zipball/dcda13432c80060cd84d4cb5f2af422d280ab895", + "reference": "dcda13432c80060cd84d4cb5f2af422d280ab895", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "socialiteproviders/manager": "~2.0 || ~3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "SocialiteProviders\\Okta\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chase Coney", + "email": "chase.coney@gmail.com" + } + ], + "description": "Okta OAuth2 Provider for Laravel Socialite", + "time": "2017-11-21T05:31:47+00:00" + }, { "name": "socialiteproviders/slack", "version": "v3.0.3", diff --git a/config/services.php b/config/services.php index a012585a1..514720d72 100644 --- a/config/services.php +++ b/config/services.php @@ -80,6 +80,14 @@ return [ 'name' => 'Microsoft Azure', ], + 'okta' => [ + 'client_id' => env('OKTA_KEY'), + 'client_secret' => env('OKTA_SECRET'), + 'redirect' => env('APP_URL') . '/login/service/okta/callback', + 'base_url' => env('OKTA_BASE_URL'), + 'name' => 'Okta', + ], + 'ldap' => [ 'server' => env('LDAP_SERVER', false), 'dn' => env('LDAP_DN', false), diff --git a/resources/assets/icons/okta.svg b/resources/assets/icons/okta.svg new file mode 100644 index 000000000..3ae0d63a3 --- /dev/null +++ b/resources/assets/icons/okta.svg @@ -0,0 +1 @@ + \ No newline at end of file