Example #1
0
class OAuthPylonsController(WSGIController):
    def __init__(self):
        self.oauth_server = OAuthServer()
        self.oauth_server.add_signature_method(OAuthSignatureMethod_HMAC_SHA1())
        self.oauth_server.add_signature_method(OAuthSignatureMethod_PLAINTEXT())

    def __call__(self, environ, start_response):
        try:
            try:
                #
                # Pylons for whatever reason changes the Authorization http parameter to
                # HTTP_AUTHORIZATION in environ.
                #
                if "HTTP_AUTHORIZATION" in environ:
                    environ['Authorization'] = environ['HTTP_AUTHORIZATION']

                self.oauth_request = OAuthRequest.from_request(http_method = environ['REQUEST_METHOD'],
                        http_url = environ['routes.url'].current(qualified=True) + '?' + environ['QUERY_STRING'],
                        headers = environ,
                        query_string = environ['QUERY_STRING'])
            except:
                pass

            return WSGIController.__call__(self, environ, start_response)
        finally:
            pass
Example #2
0
 def __init__(self):
     self.oauth_server = OAuthServer()
     self.oauth_server.add_signature_method(OAuthSignatureMethod_HMAC_SHA1())
     self.oauth_server.add_signature_method(OAuthSignatureMethod_PLAINTEXT())