Skip to content

Commit

Permalink
Socialite keycloak support (LycheeOrg#2386)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Jurriaan Saathof <jurriaan@build.xenophobia.nl>
  • Loading branch information
jsaathof and Jurriaan Saathof committed Apr 14, 2024
1 parent 3ffe070 commit cab71b6
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,10 @@ VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
# NEXTCLOUD_CLIENT_ID=
# NEXTCLOUD_CLIENT_SECRET=
# NEXTCLOUD_REDIRECT_URI=/auth/nextcloud/redirect
# NEXTCLOUD_BASE_URI=
# NEXTCLOUD_BASE_URI=
#
# KEYCLOAK_CLIENT_ID=
# KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK_REDIRECT_URI=/auth/keycloak/redirect
# KEYCLOAK_BASE_URL=
# KEYCLOAK_REALM=
1 change: 1 addition & 0 deletions app/Enum/OauthProvidersType.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ enum OauthProvidersType: string
case MASTODON = 'mastodon';
case MICROSOFT = 'microsoft';
case NEXTCLOUD = 'nextcloud';
case KEYCLOAK = 'keycloak';
}
1 change: 1 addition & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ class User extends Authenticatable implements WebAuthnAuthenticatable
'mastodon_id',
'microsoft_id',
'nextcloud_id',
'keycloak_id',
];

protected function _toArray(): array
Expand Down
2 changes: 2 additions & 0 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use SocialiteProviders\Facebook\FacebookExtendSocialite;
use SocialiteProviders\GitHub\GitHubExtendSocialite;
use SocialiteProviders\Google\GoogleExtendSocialite;
use SocialiteProviders\Keycloak\KeycloakExtendSocialite;
use SocialiteProviders\Manager\SocialiteWasCalled;
use SocialiteProviders\Microsoft\MicrosoftExtendSocialite;
use SocialiteProviders\Nextcloud\NextcloudExtendSocialite;
Expand All @@ -33,6 +34,7 @@ class EventServiceProvider extends ServiceProvider
// Mastodon is provided directly.
MicrosoftExtendSocialite::class . '@handle',
NextcloudExtendSocialite::class . '@handle',
KeycloakExtendSocialite::class . '@handle',
],
];

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"socialiteproviders/facebook": "^4.1",
"socialiteproviders/github": "^4.1",
"socialiteproviders/google": "^4.1",
"socialiteproviders/keycloak": "^5.3",
"socialiteproviders/microsoft": "^4.2",
"socialiteproviders/nextcloud": "^4.0",
"spatie/guzzle-rate-limiter-middleware": "^2.0",
Expand Down
52 changes: 51 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,11 @@
'redirect' => env('NEXTCLOUD_REDIRECT_URI', '/auth/nextcloud/redirect'),
'instance_uri' => env('NEXTCLOUD_BASE_URI'),
],
'keycloak' => [
'client_id' => env('KEYCLOAK_CLIENT_ID'),
'client_secret' => env('KEYCLOAK_CLIENT_SECRET'),
'redirect' => env('KEYCLOAK_REDIRECT_URI'),
'base_url' => env('KEYCLOAK_BASE_URL'),
'realms' => env('KEYCLOAK_REALM'),
],
];
1 change: 1 addition & 0 deletions resources/views/livewire/forms/profile/oauth.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"fa-brands fa-mastodon" => $oauthData->providerType === 'mastodon',
"fa-brands fa-microsoft" => $oauthData->providerType === 'microsoft',
"fa-solid fa-cloud" => $oauthData->providerType === 'nextcloud',
"fa-solid fa-key" => $oauthData->providerType === 'keycloak',
])></i>
@if($oauthData->isEnabled)
<span class="ml-2">
Expand Down
1 change: 1 addition & 0 deletions resources/views/livewire/modals/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class="hover:scale-125 transition-all cursor-pointer hover:text-primary-400 mb-
"fa-brands fa-mastodon" => $provider === 'mastodon',
"fa-brands fa-microsoft" => $provider === 'microsoft',
"fa-solid fa-cloud" => $provider === 'nextcloud',
"fa-solid fa-key" => $provider === 'keycloak',
])></i>
</a>
@endforeach
Expand Down

0 comments on commit cab71b6

Please sign in to comment.