support URL-param signed requests in swift3 middleware
This commit is contained in:
@@ -16,9 +16,6 @@
|
|||||||
"""
|
"""
|
||||||
The swift3 middleware will emulate the S3 REST api on top of swift.
|
The swift3 middleware will emulate the S3 REST api on top of swift.
|
||||||
|
|
||||||
The boto python library is necessary to use this middleware (install
|
|
||||||
the python-boto package if you use Ubuntu).
|
|
||||||
|
|
||||||
The following opperations are currently supported:
|
The following opperations are currently supported:
|
||||||
|
|
||||||
* GET Service
|
* GET Service
|
||||||
@@ -451,7 +448,16 @@ class Swift3Middleware(object):
|
|||||||
|
|
||||||
def __call__(self, env, start_response):
|
def __call__(self, env, start_response):
|
||||||
req = Request(env)
|
req = Request(env)
|
||||||
if not'Authorization' in req.headers:
|
|
||||||
|
if 'AWSAccessKeyId' in req.GET:
|
||||||
|
try:
|
||||||
|
req.headers['Date'] = req.GET['Expires']
|
||||||
|
req.headers['Authorization'] = \
|
||||||
|
'AWS %(AWSAccessKeyId)s:%(Signature)s' % req.GET
|
||||||
|
except KeyError:
|
||||||
|
return get_err_response('InvalidArgument')(env, start_response)
|
||||||
|
|
||||||
|
if not 'Authorization' in req.headers:
|
||||||
return self.app(env, start_response)
|
return self.app(env, start_response)
|
||||||
try:
|
try:
|
||||||
controller, path_parts = self.get_controller(req.path)
|
controller, path_parts = self.get_controller(req.path)
|
||||||
|
Reference in New Issue
Block a user