You are here

protected function MailhandlerNode::authenticateUser in Mailhandler 8

Checks if the user is authenticated.

Parameters

\Drupal\inmail\DefaultAnalyzerResult $result: The analyzer result instance.

Throws

\Exception Throws an exception in case user is not authenticated.

1 call to MailhandlerNode::authenticateUser()
MailhandlerNode::invoke in src/Plugin/inmail/Handler/MailhandlerNode.php

File

src/Plugin/inmail/Handler/MailhandlerNode.php, line 139

Class

MailhandlerNode
Message handler that creates a node from a mail message.

Namespace

Drupal\mailhandler\Plugin\inmail\Handler

Code

protected function authenticateUser(DefaultAnalyzerResult $result) {

  // Do not allow "From" mail header authorization for PGP-signed messages.
  if (!$result
    ->isUserAuthenticated() || $result
    ->hasContext('verified') && !$result
    ->getContext('verified')
    ->getContextValue()) {
    throw new \Exception('Failed to process the message. User is not authenticated.');
  }
}