diff --git a/.env.example.complete b/.env.example.complete index c4c3f0b85..e8c212f39 100644 --- a/.env.example.complete +++ b/.env.example.complete @@ -201,6 +201,28 @@ LDAP_USER_TO_GROUPS=false LDAP_GROUP_ATTRIBUTE="memberOf" LDAP_REMOVE_FROM_GROUPS=false +# SAML authentication configuration +# Refer to https://www.bookstackapp.com/docs/admin/saml2-auth/ +SAML2_NAME=SSO +SAML2_ENABLED=false +SAML2_AUTO_REGISTER=true +SAML2_EMAIL_ATTRIBUTE=email +SAML2_DISPLAY_NAME_ATTRIBUTES=username +SAML2_EXTERNAL_ID_ATTRIBUTE=null +SAML2_IDP_ENTITYID=null +SAML2_IDP_SSO=null +SAML2_IDP_SLO=null +SAML2_IDP_x509=null +SAML2_ONELOGIN_OVERRIDES=null +SAML2_DUMP_USER_DETAILS=false +SAML2_AUTOLOAD_METADATA=false + +# SAML group sync configuration +# Refer to https://www.bookstackapp.com/docs/admin/saml2-auth/ +SAML2_USER_TO_GROUPS=false +SAML2_GROUP_ATTRIBUTE=group +SAML2_REMOVE_FROM_GROUPS=false + # Disable default third-party services such as Gravatar and Draw.IO # Service-specific options will override this option DISABLE_EXTERNAL_SERVICES=false diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 304d3bed2..000833029 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -103,7 +103,11 @@ class RegisterController extends Controller { $this->checkRegistrationAllowed(); $socialDrivers = $this->socialAuthService->getActiveDrivers(); - return view('auth.register', ['socialDrivers' => $socialDrivers]); + $samlEnabled = (config('saml2.enabled') === true) && (config('saml2.auto_register') === true); + return view('auth.register', [ + 'socialDrivers' => $socialDrivers, + 'samlEnabled' => $samlEnabled, + ]); } /** diff --git a/resources/icons/saml2.svg b/resources/icons/saml2.svg new file mode 100644 index 000000000..a9a2994a7 --- /dev/null +++ b/resources/icons/saml2.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 4ac7a50e0..836150d69 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -49,7 +49,7 @@
- {{-- @icon('auth/github') --}} + @icon('saml2') {{ trans('auth.log_in_with', ['socialDriver' => config('saml2.name')]) }}
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 0e996a00d..8dd6592c1 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -49,6 +49,16 @@ @endforeach @endif + + @if($samlEnabled) +
+
+ + @icon('saml2') + {{ trans('auth.log_in_with', ['socialDriver' => config('saml2.name')]) }} + +
+ @endif @stop