コード例 #1
0
ファイル: simple_example.py プロジェクト: akatrevorjay/pyrox
 def on_request_head(self, request_message):
     user_agent_header = request_message.get_header("user-agent")
     if user_agent_header and len(user_agent_header.values) > 0:
         # If there is a user-agent value then print it out and pass
         # the request upstream
         print(user_agent_header.values[0])
         return filtering.next()
     else:
         # If there is no user-agent, then reject the request
         return filtering.reject()
コード例 #2
0
    def on_request_head(self, request_message):
        user_agent_header = request_message.get_header('user-agent')

        if user_agent_header and len(user_agent_header.values) > 0:
            # If there is a user-agent value then print it out and pass
            # the request upstream
            print(user_agent_header.values[0])
            return filtering.next()
        else:
            # If there is no user-agent, then reject the request
            return filtering.reject()
コード例 #3
0
ファイル: auth.py プロジェクト: nelsnelson/dorap
    def on_request_head(self, request_head):
        tenant_header = request_head.get_header(AUTH_TENANT_ID)
        token_header = request_head.get_header(X_AUTH_TOKEN)

        if _header_is_set(tenant_header) and _header_is_set(token_header):
            try:
                auth_result = self.client.authenticate(
                    token=token_header.values[0],
                    tenant_id=tenant_header.values[0])

                if auth_result is not False:
                    return filtering.next()
            except Exception as ex:
                _LOG.exception(ex)

        return filtering.reject()
コード例 #4
0
ファイル: keystone.py プロジェクト: chadlung/pyrox-stock
    def on_request_head(self, request_head):
        token_header = request_head.get_header(X_AUTH_TOKEN)

        if token_header and len(token_header.values) >= 1:
            match = self.id_regex.match(request_head.url)

            if match and len(match.groups()) >= 1:
                tenant_id = match.group(1)

                try:
                    auth_result = self.client.authenticate(
                        token=token_header.values[0],
                        tenant_id=tenant_id)

                    if auth_result:
                        return filtering.next()
                except Exception as ex:
                    _LOG.exception(ex)

        return filtering.reject()
コード例 #5
0
 def on_response_body_no_request(self, msg_part, body):
     return filtering.next()
コード例 #6
0
 def on_response_head_no_request(self, head):
     return filtering.next()
コード例 #7
0
 def on_response_body_with_request(self, msg_part, body, req):
     global request, on_body_got_request
     assert req == request
     on_body_got_request = True
     return filtering.next()
コード例 #8
0
 def on_response_head_with_request(self, response, req):
     global request, on_head_got_request
     assert req == request
     on_head_got_request = True
     return filtering.next()
コード例 #9
0
 def on_response_body_no_request(self, msg_part, body):
     return filtering.next()
コード例 #10
0
 def on_response_head_no_request(self, head):
     return filtering.next()
コード例 #11
0
 def on_response_body_with_request(self, msg_part, body, req):
     global request, on_body_got_request
     assert req == request
     on_body_got_request = True
     return filtering.next()
コード例 #12
0
 def on_response_head_with_request(self, response, req):
     global request, on_head_got_request
     assert req == request
     on_head_got_request = True
     return filtering.next()