Example #1
0
    def __init__(self, application, hmac_keys=None, enabled=False):
        """Initialize middleware with api-paste.ini arguments.

        :application: wsgi app
        :hmac_keys: Only trace header that was signed with one of these
                    hmac keys will be processed. This limitation is
                    essential, because it allows to profile OpenStack
                    by only those who knows this key which helps
                    avoid DDOS.
        :enabled: This middleware can be turned off fully if enabled is False.
        """
        self.application = application
        self.name = "wsgi"
        self.enabled = enabled
        self.hmac_keys = utils.split(hmac_keys or "")
Example #2
0
    def __init__(self, application, hmac_keys, enabled=False):
        """Initialize middleware with api-paste.ini arguments.

        :application: wsgi app
        :hmac_keys: Only trace header that was signed with one of these
                    hmac keys will be processed. This limitation is
                    essential, because it allows to profile OpenStack
                    by only those who knows this key which helps
                    avoid DDOS.
        :enabled: This middleware can be turned off fully if enabled is False.
        """
        self.application = application
        self.name = "wsgi"
        self.enabled = enabled
        self.hmac_keys = utils.split(hmac_keys or "")
Example #3
0
    def __init__(self, application, hmac_keys=None, enabled=False, **kwargs):
        """Initialize middleware with api-paste.ini arguments.

        :application: wsgi app
        :hmac_keys: Only trace header that was signed with one of these
                    hmac keys will be processed. This limitation is
                    essential, because it allows to profile OpenStack
                    by only those who knows this key which helps
                    avoid DDOS.
        :enabled: This middleware can be turned off fully if enabled is False.
        :kwargs: Other keyword arguments.
                 NOTE(tovin07): Currently, this `kwargs` is not used at all.
                 It's here to avoid some extra keyword arguments in local_conf
                 that cause `__init__() got an unexpected keyword argument`.
        """
        self.application = application
        self.name = "wsgi"
        self.enabled = enabled
        self.hmac_keys = utils.split(hmac_keys or "")
Example #4
0
    def __init__(self, application, hmac_keys=None, enabled=False, **kwargs):
        """Initialize middleware with api-paste.ini arguments.

        :application: wsgi app
        :hmac_keys: Only trace header that was signed with one of these
                    hmac keys will be processed. This limitation is
                    essential, because it allows to profile OpenStack
                    by only those who knows this key which helps
                    avoid DDOS.
        :enabled: This middleware can be turned off fully if enabled is False.
        :kwargs: Other keyword arguments.
                 NOTE(tovin07): Currently, this `kwargs` is not used at all.
                 It's here to avoid some extra keyword arguments in local_conf
                 that cause `__init__() got an unexpected keyword argument`.
        """
        self.application = application
        self.name = "wsgi"
        self.enabled = enabled
        self.hmac_keys = utils.split(hmac_keys or "")
Example #5
0
 def test_split(self):
     self.assertEqual([1, 2], utils.split([1, 2]))
     self.assertEqual(["A", "B"], utils.split("A, B"))
     self.assertEqual(["A", " B"], utils.split("A, B", strip=False))
Example #6
0
 def __init__(self, application, hmac_keys=None, enabled=False):
     self.application = application
     self.name = "wsgi"
     self.enabled = enabled
     self.hmac_keys = utils.split(hmac_keys or "")
Example #7
0
def enable(hmac_keys=None):
    """Enable middleware."""
    global _ENABLED, _HMAC_KEYS
    _ENABLED = True
    _HMAC_KEYS = utils.split(hmac_keys or "")
Example #8
0
def enable(hmac_keys=None):
    """Enable middleware."""
    global _ENABLED, _HMAC_KEYS
    _ENABLED = True
    _HMAC_KEYS = utils.split(hmac_keys or "")
Example #9
0
 def __init__(self, application, hmac_keys=None, enabled=False):
     self.application = application
     self.name = "wsgi"
     self.enabled = enabled
     self.hmac_keys = utils.split(hmac_keys or "")
Example #10
0
def enable(hmac_keys=None):
    """Enable middleware."""
    global _DISABLED, _HMAC_KEYS
    _DISABLED = False
    _HMAC_KEYS = utils.split(hmac_keys or "")