Esempio n. 1
0
 def test_presigned_invalid_expires(self):
     presign_v4('GET',
                'http://localhost:9000/hello',
                None,
                region=None,
                headers={},
                expires=0)
Esempio n. 2
0
 def test_presigned_invalid_expires(self):
     credentials = Credentials(provider=Static())
     presign_v4('GET',
                'http://localhost:9000/hello',
                credentials,
                region=None,
                headers={},
                expires=0)
Esempio n. 3
0
def get_image(filename):
    bucket_name = current_app.config.get('IMAGES_BUCKET_NAME')
    access_key = current_app.config.get('MINIO_ACCESS_KEY')
    secret_key = current_app.config.get('MINIO_SECRET_KEY')
    storage_endpoint = current_app.config.get('STORAGE_ENDPOINT')

    url = presign_v4('GET', f'{storage_endpoint}/{bucket_name}/{filename}',
                     access_key, secret_key)
    return redirect(url)
Esempio n. 4
0
    def test_presigned_versioned_id(self):
        credentials = Credentials("minio", "minio123")
        url = presign_v4(
            'GET',
            urlsplit(
                'http://localhost:9000/bucket-name/objectName?versionId=uuid'),
            'us-east-1', credentials, dt, 604800)

        eq_(
            urlunsplit(url),
            'http://localhost:9000/bucket-name/objectName?versionId=uuid&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20150620%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20150620T010203Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=3ce13e2ca929fafa20581a05730e4e9435f2a5e20ec7c5a082d175692fb0a663'
        )
Esempio n. 5
0
 def test_presigned_no_access_key(self):
     presign_v4('GET', 'http://localhost:9000/hello', None, None)
Esempio n. 6
0
 def test_presigned_no_access_key(self):
     credentials = Credentials(provider=Static())
     presign_v4('GET', 'http://localhost:9000/hello', credentials, None)
Esempio n. 7
0
 def test_presigned_invalid_expires(self):
     presign_v4('GET', 'http://localhost:9000/hello', None, None, region=None, headers={}, expires=0)
Esempio n. 8
0
 def test_presigned_no_access_key(self):
     presign_v4('GET', 'http://localhost:9000/hello', None, None)
Esempio n. 9
0
 def test_presigned_no_access_key(self):
     presign_v4("GET", "http://localhost:9000/hello", None, None)