How to make sure simpleSamlAuth module is working as intended? I'm working on a Drupal site which is utilizing the simpleSAMLphp_auth module. We want users to be able to log in using their Gmail accounts, so long as they have an pre-existing Drupal account to match. If it turns out they do not, I don't want them being authenticated.

As of now, when I attempt to use the federated login through Gmail, it seems to authenticate me because it doesn't complain at all about access being denied. It simply takes me back to the homepage of our Drupal website.

How can I check if I am actually being authenticated, even though the email I am testing with the federated login does not have a pre-existing Drupal account associated with it?

Also, I am using the email as the simpleSAML attribute for the users unique identifier and for their email as well.
There are hooks and config in the module UI that should aid in this. Here is an example from a Drupal 8 project I did that does just this:

/**
 * Implements hook_simplesamlphp_auth_allow_login().
 */
function MYMODULE_simplesamlphp_auth_allow_login(array $attributes) : bool {
  // Debugging purposes
  \Drupal::logger('mymodule')-&gt;log('info', 'Attributes contained: @attributes', ['@attributes' =&gt; $attributes]);

  if (empty($attributes['EMAIL_ATTRIBUTE_IDENTIFIER'])) {
    \Drupal::logger('mymodule')-&gt;log('info', 'Attribute was not present.', ['@attributes' =&gt; $attributes]);
    return FALSE;
  }

  // Run a query to see if the user exists by email address in Drupal
  $exists = // query users by email address

  return $exists;
}


Perhaps a simpler approach in your case would be hook_form_alter, adding a new submit handler and doing the email check there before anything else happens, but the hook above is the final say-so in if a user can authenticate and login or not.