Merge pull request #4545 from coollabsio/authentik

Feat: Authentik Oauth
This commit is contained in:
Andras Bacsai
2024-12-12 10:22:23 +01:00
committed by GitHub
11 changed files with 298 additions and 233 deletions

View File

@@ -17,6 +17,7 @@ class SettingsOauth extends Component
$carry["oauth_settings_map.$setting->provider.client_secret"] = 'nullable';
$carry["oauth_settings_map.$setting->provider.redirect_uri"] = 'nullable';
$carry["oauth_settings_map.$setting->provider.tenant"] = 'nullable';
$carry["oauth_settings_map.$setting->provider.base_url"] = 'nullable';
return $carry;
}, []);

View File

@@ -9,6 +9,9 @@ use App\Listeners\ProxyStartedNotification;
use Illuminate\Foundation\Events\MaintenanceModeDisabled;
use Illuminate\Foundation\Events\MaintenanceModeEnabled;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use SocialiteProviders\Authentik\AuthentikExtendSocialite;
use SocialiteProviders\Azure\AzureExtendSocialite;
use SocialiteProviders\Manager\SocialiteWasCalled;
class EventServiceProvider extends ServiceProvider
{
@@ -19,8 +22,9 @@ class EventServiceProvider extends ServiceProvider
MaintenanceModeDisabled::class => [
MaintenanceModeDisabledNotification::class,
],
\SocialiteProviders\Manager\SocialiteWasCalled::class => [
\SocialiteProviders\Azure\AzureExtendSocialite::class.'@handle',
SocialiteWasCalled::class => [
AzureExtendSocialite::class.'@handle',
AuthentikExtendSocialite::class.'@handle',
],
ProxyStarted::class => [
ProxyStartedNotification::class,

View File

@@ -18,6 +18,17 @@ function get_socialite_provider(string $provider)
return Socialite::driver('azure')->setConfig($azure_config);
}
if ($provider == 'authentik') {
$authentik_config = new \SocialiteProviders\Manager\Config(
$oauth_setting->client_id,
$oauth_setting->client_secret,
$oauth_setting->redirect_uri,
['base_url' => $oauth_setting->base_url],
);
return Socialite::driver('authentik')->setConfig($authentik_config);
}
$config = [
'client_id' => $oauth_setting->client_id,
'client_secret' => $oauth_setting->client_secret,

View File

@@ -39,6 +39,7 @@
"pusher/pusher-php-server": "^7.2",
"resend/resend-laravel": "^0.15.0",
"sentry/sentry-laravel": "^4.6",
"socialiteproviders/authentik": "^5.2",
"socialiteproviders/microsoft-azure": "^5.1",
"spatie/laravel-activitylog": "^4.7.3",
"spatie/laravel-data": "^4.11",

388
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d96fe0aedd865274164c34a1b04195fe",
"content-hash": "871067cb42e6347ca53ff36e81ac5079",
"packages": [
{
"name": "3sidedcube/laravel-redoc",
@@ -979,16 +979,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.334.2",
"version": "3.334.3",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "b19afc076bb1cc2617bdef76efd41587596109e7"
"reference": "6576a9fcfc6ae7c76aed3c6fa4c3864060f72d04"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b19afc076bb1cc2617bdef76efd41587596109e7",
"reference": "b19afc076bb1cc2617bdef76efd41587596109e7",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/6576a9fcfc6ae7c76aed3c6fa4c3864060f72d04",
"reference": "6576a9fcfc6ae7c76aed3c6fa4c3864060f72d04",
"shasum": ""
},
"require": {
@@ -1071,9 +1071,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.334.2"
"source": "https://github.com/aws/aws-sdk-php/tree/3.334.3"
},
"time": "2024-12-09T19:30:23+00:00"
"time": "2024-12-10T19:41:55+00:00"
},
{
"name": "bacon/bacon-qr-code",
@@ -3313,16 +3313,16 @@
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.x-dev"
},
"laravel": {
"providers": [
"Laravel\\Socialite\\SocialiteServiceProvider"
],
"aliases": {
"Socialite": "Laravel\\Socialite\\Facades\\Socialite"
}
},
"providers": [
"Laravel\\Socialite\\SocialiteServiceProvider"
]
},
"branch-alias": {
"dev-master": "5.x-dev"
}
},
"autoload": {
@@ -4037,16 +4037,16 @@
},
{
"name": "league/oauth1-client",
"version": "v1.10.1",
"version": "v1.11.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/oauth1-client.git",
"reference": "d6365b901b5c287dd41f143033315e2f777e1167"
"reference": "f9c94b088837eb1aae1ad7c4f23eb65cc6993055"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/d6365b901b5c287dd41f143033315e2f777e1167",
"reference": "d6365b901b5c287dd41f143033315e2f777e1167",
"url": "https://api.github.com/repos/thephpleague/oauth1-client/zipball/f9c94b088837eb1aae1ad7c4f23eb65cc6993055",
"reference": "f9c94b088837eb1aae1ad7c4f23eb65cc6993055",
"shasum": ""
},
"require": {
@@ -4107,9 +4107,9 @@
],
"support": {
"issues": "https://github.com/thephpleague/oauth1-client/issues",
"source": "https://github.com/thephpleague/oauth1-client/tree/v1.10.1"
"source": "https://github.com/thephpleague/oauth1-client/tree/v1.11.0"
},
"time": "2022-04-15T14:02:14+00:00"
"time": "2024-12-10T19:59:05+00:00"
},
{
"name": "league/uri",
@@ -5952,64 +5952,6 @@
},
"time": "2024-10-13T11:29:49+00:00"
},
{
"name": "phpstan/phpstan",
"version": "1.12.12",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0",
"reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"docs": "https://phpstan.org/user-guide/getting-started",
"forum": "https://github.com/phpstan/phpstan/discussions",
"issues": "https://github.com/phpstan/phpstan/issues",
"security": "https://github.com/phpstan/phpstan/security/policy",
"source": "https://github.com/phpstan/phpstan-src"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
}
],
"time": "2024-11-28T22:13:23+00:00"
},
{
"name": "pimple/pimple",
"version": "v3.5.0",
@@ -7099,65 +7041,6 @@
],
"time": "2024-04-27T21:32:50+00:00"
},
{
"name": "rector/rector",
"version": "1.2.10",
"source": {
"type": "git",
"url": "https://github.com/rectorphp/rector.git",
"reference": "40f9cf38c05296bd32f444121336a521a293fa61"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/40f9cf38c05296bd32f444121336a521a293fa61",
"reference": "40f9cf38c05296bd32f444121336a521a293fa61",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0",
"phpstan/phpstan": "^1.12.5"
},
"conflict": {
"rector/rector-doctrine": "*",
"rector/rector-downgrade-php": "*",
"rector/rector-phpunit": "*",
"rector/rector-symfony": "*"
},
"suggest": {
"ext-dom": "To manipulate phpunit.xml via the custom-rule command"
},
"bin": [
"bin/rector"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Instant Upgrade and Automated Refactoring of any PHP code",
"keywords": [
"automation",
"dev",
"migration",
"refactoring"
],
"support": {
"issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/1.2.10"
},
"funding": [
{
"url": "https://github.com/tomasvotruba",
"type": "github"
}
],
"time": "2024-11-08T13:59:10+00:00"
},
{
"name": "resend/resend-laravel",
"version": "v0.15.0",
@@ -7534,6 +7417,56 @@
],
"time": "2024-11-24T11:02:20+00:00"
},
{
"name": "socialiteproviders/authentik",
"version": "5.2.0",
"source": {
"type": "git",
"url": "https://github.com/SocialiteProviders/Authentik.git",
"reference": "4cf129cf04728a38e0531c54454464b162f0fa66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/SocialiteProviders/Authentik/zipball/4cf129cf04728a38e0531c54454464b162f0fa66",
"reference": "4cf129cf04728a38e0531c54454464b162f0fa66",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^8.0",
"socialiteproviders/manager": "^4.4"
},
"type": "library",
"autoload": {
"psr-4": {
"SocialiteProviders\\Authentik\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "rf152",
"email": "git@rf152.co.uk"
}
],
"description": "Authentik OAuth2 Provider for Laravel Socialite",
"keywords": [
"authentik",
"laravel",
"oauth",
"provider",
"socialite"
],
"support": {
"docs": "https://socialiteproviders.com/authentik",
"issues": "https://github.com/socialiteproviders/providers/issues",
"source": "https://github.com/socialiteproviders/providers"
},
"time": "2023-11-07T22:21:16+00:00"
},
{
"name": "socialiteproviders/manager",
"version": "v4.7.0",
@@ -7959,40 +7892,41 @@
},
{
"name": "spatie/laravel-ray",
"version": "1.37.1",
"version": "1.39.0",
"source": {
"type": "git",
"url": "https://github.com/spatie/laravel-ray.git",
"reference": "c2bedfd1172648df2c80aaceb2541d70f1d9a5b9"
"reference": "31b601f98590606d20e76b5dd68578dc1642cd2c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ray/zipball/c2bedfd1172648df2c80aaceb2541d70f1d9a5b9",
"reference": "c2bedfd1172648df2c80aaceb2541d70f1d9a5b9",
"url": "https://api.github.com/repos/spatie/laravel-ray/zipball/31b601f98590606d20e76b5dd68578dc1642cd2c",
"reference": "31b601f98590606d20e76b5dd68578dc1642cd2c",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.2",
"ext-json": "*",
"illuminate/contracts": "^7.20|^8.19|^9.0|^10.0|^11.0",
"illuminate/database": "^7.20|^8.19|^9.0|^10.0|^11.0",
"illuminate/queue": "^7.20|^8.19|^9.0|^10.0|^11.0",
"illuminate/support": "^7.20|^8.19|^9.0|^10.0|^11.0",
"php": "^7.4|^8.0",
"rector/rector": "^0.19.2|^1.0",
"illuminate/contracts": "^7.20 || ^8.19 || ^9.0 || ^10.0 || ^11.0",
"illuminate/database": "^7.20 || ^8.19 || ^9.0 || ^10.0 || ^11.0",
"illuminate/queue": "^7.20 || ^8.19 || ^9.0 || ^10.0 || ^11.0",
"illuminate/support": "^7.20 || ^8.19 || ^9.0 || ^10.0 || ^11.0",
"php": "^7.4 || ^8.0",
"spatie/backtrace": "^1.0",
"spatie/ray": "^1.41.1",
"symfony/stopwatch": "4.2|^5.1|^6.0|^7.0",
"zbateson/mail-mime-parser": "^1.3.1|^2.0|^3.0"
"spatie/ray": "^1.41.3",
"symfony/stopwatch": "4.2 || ^5.1 || ^6.0 || ^7.0",
"zbateson/mail-mime-parser": "^1.3.1 || ^2.0 || ^3.0"
},
"require-dev": {
"guzzlehttp/guzzle": "^7.3",
"laravel/framework": "^7.20|^8.19|^9.0|^10.0|^11.0",
"orchestra/testbench-core": "^5.0|^6.0|^7.0|^8.0|^9.0",
"pestphp/pest": "^1.22|^2.0",
"phpstan/phpstan": "^1.10.57",
"phpunit/phpunit": "^9.3|^10.1",
"spatie/pest-plugin-snapshots": "^1.1|^2.0",
"symfony/var-dumper": "^4.2|^5.1|^6.0|^7.0.3"
"laravel/framework": "^7.20 || ^8.19 || ^9.0 || ^10.0 || ^11.0",
"orchestra/testbench-core": "^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
"pestphp/pest": "^1.22 || ^2.0",
"phpstan/phpstan": "^1.10.57 || ^2.0.2",
"phpunit/phpunit": "^9.3 || ^10.1",
"rector/rector": "dev-main",
"spatie/pest-plugin-snapshots": "^1.1 || ^2.0",
"symfony/var-dumper": "^4.2 || ^5.1 || ^6.0 || ^7.0.3"
},
"type": "library",
"extra": {
@@ -8030,7 +7964,7 @@
],
"support": {
"issues": "https://github.com/spatie/laravel-ray/issues",
"source": "https://github.com/spatie/laravel-ray/tree/1.37.1"
"source": "https://github.com/spatie/laravel-ray/tree/1.39.0"
},
"funding": [
{
@@ -8042,7 +7976,7 @@
"type": "other"
}
],
"time": "2024-07-12T12:35:17+00:00"
"time": "2024-12-11T09:34:41+00:00"
},
{
"name": "spatie/laravel-schemaless-attributes",
@@ -8532,16 +8466,16 @@
},
{
"name": "symfony/console",
"version": "v7.2.0",
"version": "v7.2.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "23c8aae6d764e2bae02d2a99f7532a7f6ed619cf"
"reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/23c8aae6d764e2bae02d2a99f7532a7f6ed619cf",
"reference": "23c8aae6d764e2bae02d2a99f7532a7f6ed619cf",
"url": "https://api.github.com/repos/symfony/console/zipball/fefcc18c0f5d0efe3ab3152f15857298868dc2c3",
"reference": "fefcc18c0f5d0efe3ab3152f15857298868dc2c3",
"shasum": ""
},
"require": {
@@ -8605,7 +8539,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.2.0"
"source": "https://github.com/symfony/console/tree/v7.2.1"
},
"funding": [
{
@@ -8621,7 +8555,7 @@
"type": "tidelift"
}
],
"time": "2024-11-06T14:24:19+00:00"
"time": "2024-12-11T03:49:26+00:00"
},
{
"name": "symfony/css-selector",
@@ -8757,16 +8691,16 @@
},
{
"name": "symfony/error-handler",
"version": "v7.2.0",
"version": "v7.2.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/error-handler.git",
"reference": "672b3dd1ef8b87119b446d67c58c106c43f965fe"
"reference": "6150b89186573046167796fa5f3f76601d5145f8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/672b3dd1ef8b87119b446d67c58c106c43f965fe",
"reference": "672b3dd1ef8b87119b446d67c58c106c43f965fe",
"url": "https://api.github.com/repos/symfony/error-handler/zipball/6150b89186573046167796fa5f3f76601d5145f8",
"reference": "6150b89186573046167796fa5f3f76601d5145f8",
"shasum": ""
},
"require": {
@@ -8812,7 +8746,7 @@
"description": "Provides tools to manage errors and ease debugging PHP code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/error-handler/tree/v7.2.0"
"source": "https://github.com/symfony/error-handler/tree/v7.2.1"
},
"funding": [
{
@@ -8828,7 +8762,7 @@
"type": "tidelift"
}
],
"time": "2024-11-05T15:35:02+00:00"
"time": "2024-12-07T08:50:44+00:00"
},
{
"name": "symfony/event-dispatcher",
@@ -9130,16 +9064,16 @@
},
{
"name": "symfony/http-kernel",
"version": "v7.2.0",
"version": "v7.2.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "6b4722a25e0aed1ccb4914b9bcbd493cc4676b4d"
"reference": "d8ae58eecae44c8e66833e76cc50a4ad3c002d97"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/6b4722a25e0aed1ccb4914b9bcbd493cc4676b4d",
"reference": "6b4722a25e0aed1ccb4914b9bcbd493cc4676b4d",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/d8ae58eecae44c8e66833e76cc50a4ad3c002d97",
"reference": "d8ae58eecae44c8e66833e76cc50a4ad3c002d97",
"shasum": ""
},
"require": {
@@ -9224,7 +9158,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v7.2.0"
"source": "https://github.com/symfony/http-kernel/tree/v7.2.1"
},
"funding": [
{
@@ -9240,7 +9174,7 @@
"type": "tidelift"
}
],
"time": "2024-11-29T08:42:40+00:00"
"time": "2024-12-11T12:09:10+00:00"
},
{
"name": "symfony/mailer",
@@ -9324,16 +9258,16 @@
},
{
"name": "symfony/mime",
"version": "v7.2.0",
"version": "v7.2.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/mime.git",
"reference": "cc84a4b81f62158c3846ac7ff10f696aae2b524d"
"reference": "7f9617fcf15cb61be30f8b252695ed5e2bfac283"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/cc84a4b81f62158c3846ac7ff10f696aae2b524d",
"reference": "cc84a4b81f62158c3846ac7ff10f696aae2b524d",
"url": "https://api.github.com/repos/symfony/mime/zipball/7f9617fcf15cb61be30f8b252695ed5e2bfac283",
"reference": "7f9617fcf15cb61be30f8b252695ed5e2bfac283",
"shasum": ""
},
"require": {
@@ -9388,7 +9322,7 @@
"mime-type"
],
"support": {
"source": "https://github.com/symfony/mime/tree/v7.2.0"
"source": "https://github.com/symfony/mime/tree/v7.2.1"
},
"funding": [
{
@@ -9404,7 +9338,7 @@
"type": "tidelift"
}
],
"time": "2024-11-23T09:19:39+00:00"
"time": "2024-12-07T08:50:44+00:00"
},
{
"name": "symfony/options-resolver",
@@ -13222,17 +13156,75 @@
"time": "2024-11-21T15:12:59+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "11.0.7",
"name": "phpstan/phpstan",
"version": "1.12.12",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca"
"url": "https://github.com/phpstan/phpstan.git",
"reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/f7f08030e8811582cc459871d28d6f5a1a4d35ca",
"reference": "f7f08030e8811582cc459871d28d6f5a1a4d35ca",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0",
"reference": "b5ae1b88f471d3fd4ba1aa0046234b5ca3776dd0",
"shasum": ""
},
"require": {
"php": "^7.2|^8.0"
},
"conflict": {
"phpstan/phpstan-shim": "*"
},
"bin": [
"phpstan",
"phpstan.phar"
],
"type": "library",
"autoload": {
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"keywords": [
"dev",
"static analysis"
],
"support": {
"docs": "https://phpstan.org/user-guide/getting-started",
"forum": "https://github.com/phpstan/phpstan/discussions",
"issues": "https://github.com/phpstan/phpstan/issues",
"security": "https://github.com/phpstan/phpstan/security/policy",
"source": "https://github.com/phpstan/phpstan-src"
},
"funding": [
{
"url": "https://github.com/ondrejmirtes",
"type": "github"
},
{
"url": "https://github.com/phpstan",
"type": "github"
}
],
"time": "2024-11-28T22:13:23+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "11.0.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "418c59fd080954f8c4aa5631d9502ecda2387118"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118",
"reference": "418c59fd080954f8c4aa5631d9502ecda2387118",
"shasum": ""
},
"require": {
@@ -13251,7 +13243,7 @@
"theseer/tokenizer": "^1.2.3"
},
"require-dev": {
"phpunit/phpunit": "^11.4.1"
"phpunit/phpunit": "^11.5.0"
},
"suggest": {
"ext-pcov": "PHP extension that provides line coverage",
@@ -13289,7 +13281,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.7"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.8"
},
"funding": [
{
@@ -13297,7 +13289,7 @@
"type": "github"
}
],
"time": "2024-10-09T06:21:38+00:00"
"time": "2024-12-11T12:34:27+00:00"
},
{
"name": "phpunit/php-file-iterator",
@@ -14615,16 +14607,16 @@
},
{
"name": "spatie/error-solutions",
"version": "1.1.1",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/spatie/error-solutions.git",
"reference": "ae7393122eda72eed7cc4f176d1e96ea444f2d67"
"reference": "d239a65235a1eb128dfa0a4e4c4ef032ea11b541"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/error-solutions/zipball/ae7393122eda72eed7cc4f176d1e96ea444f2d67",
"reference": "ae7393122eda72eed7cc4f176d1e96ea444f2d67",
"url": "https://api.github.com/repos/spatie/error-solutions/zipball/d239a65235a1eb128dfa0a4e4c4ef032ea11b541",
"reference": "d239a65235a1eb128dfa0a4e4c4ef032ea11b541",
"shasum": ""
},
"require": {
@@ -14677,7 +14669,7 @@
],
"support": {
"issues": "https://github.com/spatie/error-solutions/issues",
"source": "https://github.com/spatie/error-solutions/tree/1.1.1"
"source": "https://github.com/spatie/error-solutions/tree/1.1.2"
},
"funding": [
{
@@ -14685,7 +14677,7 @@
"type": "github"
}
],
"time": "2024-07-25T11:06:04+00:00"
"time": "2024-12-11T09:51:56+00:00"
},
{
"name": "spatie/flare-client-php",

View File

@@ -30,12 +30,4 @@ return [
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'azure' => [
'client_id' => env('AZURE_CLIENT_ID'),
'client_secret' => env('AZURE_CLIENT_SECRET'),
'redirect' => env('AZURE_REDIRECT_URI'),
'tenant' => env('AZURE_TENANT_ID'),
'proxy' => env('AZURE_PROXY'),
],
];

View File

@@ -45,11 +45,11 @@ return new class extends Migration
public function down(): void
{
Schema::table('instance_settings', function (Blueprint $table) {
$table->string('smtp_from_address')->nullable()->change();
$table->string('smtp_from_name')->nullable()->change();
$table->string('smtp_recipients')->nullable()->change();
$table->string('smtp_host')->nullable()->change();
$table->string('smtp_username')->nullable()->change();
$table->text('smtp_from_address')->nullable()->change();
$table->text('smtp_from_name')->nullable()->change();
$table->text('smtp_recipients')->nullable()->change();
$table->text('smtp_host')->nullable()->change();
$table->text('smtp_username')->nullable()->change();
});
if (DB::table('instance_settings')->exists()) {

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('oauth_settings', function (Blueprint $table) {
$table->string('base_url')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('oauth_settings', function (Blueprint $table) {
$table->dropColumn('base_url');
});
}
};

View File

@@ -12,25 +12,56 @@ class OauthSettingSeeder extends Seeder
*/
public function run(): void
{
OauthSetting::firstOrCreate([
'id' => 0,
'provider' => 'azure',
$providers = collect([
'azure',
'bitbucket',
'github',
'gitlab',
'google',
'authentik',
]);
OauthSetting::firstOrCreate([
'id' => 1,
'provider' => 'bitbucket',
$isOauthSeeded = OauthSetting::count() > 0;
$isOauthWithZeroId = OauthSetting::where('id', 0)->exists();
if ($isOauthSeeded) {
if ($isOauthWithZeroId) {
$allProviders = OauthSetting::all();
$notFoundProviders = $providers->diff($allProviders->pluck('provider'));
$allProviders->each(function ($provider) use ($providers) {
$provider->delete();
$providerName = $provider->provider;
$foundProvider = $providers->first(function ($provider) use ($providerName) {
return $provider === $providerName;
});
if ($foundProvider) {
$newProvder = new OauthSetting;
$newProvder = $provider;
unset($newProvder->id);
$newProvder->save();
}
});
foreach ($notFoundProviders as $provider) {
OauthSetting::create([
'provider' => $provider,
]);
OauthSetting::firstOrCreate([
'id' => 2,
'provider' => 'github',
]);
OauthSetting::firstOrCreate([
'id' => 3,
'provider' => 'gitlab',
]);
OauthSetting::firstOrCreate([
'id' => 4,
'provider' => 'google',
}
} else {
foreach ($providers as $provider) {
OauthSetting::updateOrCreate([
'provider' => $provider,
]);
}
}
} else {
foreach ($providers as $provider) {
OauthSetting::create([
'provider' => $provider,
]);
}
}
}
}

View File

@@ -1,5 +1,6 @@
{
"auth.login": "Login",
"auth.login.authentik": "Login with Authentik",
"auth.login.azure": "Login with Microsoft",
"auth.login.bitbucket": "Login with Bitbucket",
"auth.login.github": "Login with GitHub",

View File

@@ -16,7 +16,7 @@
<div class="flex flex-col gap-2 pt-4">
@foreach ($oauth_settings_map as $oauth_setting)
<div class="p-4 border dark:border-coolgray-300">
<h3>{{ ucfirst($oauth_setting->provider) }} Oauth</h3>
<h3>{{ ucfirst($oauth_setting->provider) }}</h3>
<div class="w-32">
<x-forms.checkbox instantSave id="oauth_settings_map.{{ $oauth_setting->provider }}.enabled"
label="Enabled" />
@@ -32,6 +32,10 @@
<x-forms.input id="oauth_settings_map.{{ $oauth_setting->provider }}.tenant"
label="Tenant" />
@endif
@if ($oauth_setting->provider == 'authentik')
<x-forms.input id="oauth_settings_map.{{ $oauth_setting->provider }}.base_url"
label="Base URL" />
@endif
</div>
</div>
@endforeach