Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example.complete
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ TWITTER_APP_SECRET=false
TWITTER_AUTO_REGISTER=false
TWITTER_AUTO_CONFIRM_EMAIL=false

KEYCLOAK_APP_ID=false
KEYCLOAK_APP_SECRET=false
KEYCLOAK_AUTO_REGISTER=false
KEYCLOAK_AUTO_CONFIRM_EMAIL=false

# LDAP authentication configuration
# Refer to https://www.bookstackapp.com/docs/admin/ldap-auth/
LDAP_SERVER=false
Expand Down
5 changes: 4 additions & 1 deletion app/Auth/Access/SocialAuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SocialAuthService
protected $socialite;
protected $socialAccount;

protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta', 'gitlab', 'twitch', 'discord'];
protected $validSocialDrivers = ['google', 'github', 'facebook', 'slack', 'twitter', 'azure', 'okta', 'gitlab', 'twitch', 'discord', 'keycloak'];

/**
* SocialAuthService constructor.
Expand Down Expand Up @@ -237,6 +237,9 @@ public function getSocialDriver(string $driverName): Provider
if ($driverName === 'azure') {
$driver->with(['resource' => 'https://graph.windows.net']);
}
if ($driverName === 'keycloak') {
$driver->scopes(['openid']);
}

return $driver;
}
Expand Down
11 changes: 11 additions & 0 deletions app/Config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,17 @@
'auto_confirm' => env('DISCORD_AUTO_CONFIRM_EMAIL', false),
],

'keycloak' => [
'client_id' => env('KEYCLOAK_CLIENT_ID'),
'client_secret' => env('KEYCLOAK_CLIENT_SECRET'),
'redirect' => env('APP_URL') . '/login/service/keycloak/callback',
'name' => 'Keycloak',
'base_url' => env('KEYCLOAK_BASE_URL'),
'realms' => env('KEYCLOAK_REALM'),
'auto_register' => env('KEYCLOAK_AUTO_REGISTER', false),
'auto_confirm' => env('KEYCLOAK_AUTO_CONFIRM_EMAIL', false),
],

'ldap' => [
'server' => env('LDAP_SERVER', false),
'dump_user_details' => env('LDAP_DUMP_USER_DETAILS', false),
Expand Down
1 change: 1 addition & 0 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class EventServiceProvider extends ServiceProvider
'SocialiteProviders\GitLab\GitLabExtendSocialite@handle',
'SocialiteProviders\Twitch\TwitchExtendSocialite@handle',
'SocialiteProviders\Discord\DiscordExtendSocialite@handle',
'SocialiteProviders\Keycloak\KeycloakExtendSocialite@handle',
],
];

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"socialiteproviders/okta": "^4.1",
"socialiteproviders/slack": "^4.1",
"socialiteproviders/twitch": "^5.3",
"socialiteproviders/keycloak": "^4.1",
"ssddanbrown/htmldiff": "^v1.0.1"
},
"require-dev": {
Expand Down