Esempio n. 1
0
 /**
  * Post authentication hook.
  *
  * This method is called from authenticate_user_login() for all enabled auth plugins.
  *
  * @param object $user user object, later used for $USER
  * @param string $username (with system magic quotes)
  * @param string $password plain text password (with system magic quotes)
  */
 public function user_authenticated_hook(&$user, $username, $password)
 {
     if (!empty($user) && !empty($user->auth) && $user->auth === 'oidc') {
         $eventdata = ['objectid' => $user->id, 'userid' => $user->id, 'other' => ['username' => $user->username]];
         $event = \auth_oidc\event\user_loggedin::create($eventdata);
         $event->trigger();
     }
 }
Esempio n. 2
0
 /**
  * Handles logins from the OpenID Connect auth plugin.
  *
  * Does the following:
  *     - Uses the received OIDC auth code to get tokens for the other resources we use: onedrive, sharepoint, outlook.
  *
  * @param \auth_oidc\event\user_loggedin $event The triggered event.
  * @return bool Success/Failure.
  */
 public static function handle_oidc_user_loggedin(\auth_oidc\event\user_loggedin $event)
 {
     if (\local_o365\utils::is_configured() !== true) {
         return false;
     }
     // Get additional tokens for the user.
     $eventdata = $event->get_data();
     if (!empty($eventdata['other']['username']) && !empty($eventdata['userid'])) {
         static::get_additional_user_info($eventdata['userid'], 'login');
     }
     return true;
 }
Esempio n. 3
0
 /**
  * Handles logins from the OpenID Connect auth plugin.
  *
  * Does the following:
  *     - Uses the received OIDC auth code to get tokens for the other resources we use: onedrive, sharepoint, outlook.
  *
  * @param \auth_oidc\event\user_loggedin $event The triggered event.
  * @return bool Success/Failure.
  */
 public static function handle_oidc_user_loggedin(\auth_oidc\event\user_loggedin $event)
 {
     // Get additional tokens for the user.
     $eventdata = $event->get_data();
     if (!empty($eventdata['other']['username']) && !empty($eventdata['userid'])) {
         static::get_additional_user_info($eventdata['userid']);
     }
     return true;
 }