]> BookStack Code Mirror - bookstack/blobdiff - app/Auth/Access/Saml2Service.php
Extend /users API endpoint
[bookstack] / app / Auth / Access / Saml2Service.php
index 8f9a24cdeacd142106c0a92411962bd59de877c5..105853997cd4d939c3fefe66678915dea89bdaa9 100644 (file)
@@ -1,9 +1,13 @@
 <?php namespace BookStack\Auth\Access;
 
+use BookStack\Actions\ActivityType;
 use BookStack\Auth\User;
 use BookStack\Exceptions\JsonDebugException;
 use BookStack\Exceptions\SamlException;
 use BookStack\Exceptions\UserRegistrationException;
+use BookStack\Facades\Activity;
+use BookStack\Facades\Theme;
+use BookStack\Theming\ThemeEvents;
 use Exception;
 use Illuminate\Support\Str;
 use OneLogin\Saml2\Auth;
@@ -311,7 +315,6 @@ class Saml2Service extends ExternalAuthService
 
     /**
      * Get the user from the database for the specified details.
-     * @throws SamlException
      * @throws UserRegistrationException
      */
     protected function getOrRegisterUser(array $userDetails): ?User
@@ -373,6 +376,8 @@ class Saml2Service extends ExternalAuthService
         }
 
         auth()->login($user);
+        Activity::add(ActivityType::AUTH_LOGIN, "saml2; {$user->logDescriptor()}");
+        Theme::dispatch(ThemeEvents::AUTH_LOGIN, 'saml2', $user);
         return $user;
     }
 }