mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-15 04:17:16 +00:00
21 lines
573 B
Python
21 lines
573 B
Python
import logging
|
|
|
|
from tfw.internals.crypto import KeyManager, verify_message
|
|
|
|
from .event_handler import EventHandler
|
|
|
|
LOG = logging.getLogger(__name__)
|
|
|
|
|
|
# pylint: disable=abstract-method
|
|
class SignedEventHandler(EventHandler):
|
|
def __init__(self, connector):
|
|
self._auth_key = KeyManager().auth_key
|
|
super().__init__(connector)
|
|
|
|
def _validate_message(self, message):
|
|
is_valid = verify_message(self._auth_key, message)
|
|
if not is_valid:
|
|
LOG.error('Message does not have valid signature: %s', message)
|
|
return is_valid
|