mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 14:34:21 +01:00
added support for S3 signature version 4 authentication (#1882)
* added support for S3 signature version 4 authentication
This commit is contained in:
@@ -5,6 +5,7 @@ from pathlib import PurePath
|
|||||||
from shutil import copyfileobj, rmtree
|
from shutil import copyfileobj, rmtree
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
|
from botocore.client import Config
|
||||||
from flask import current_app, redirect, send_file
|
from flask import current_app, redirect, send_file
|
||||||
from flask.helpers import safe_join
|
from flask.helpers import safe_join
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
@@ -86,6 +87,7 @@ class S3Uploader(BaseUploader):
|
|||||||
endpoint = get_app_config("AWS_S3_ENDPOINT_URL")
|
endpoint = get_app_config("AWS_S3_ENDPOINT_URL")
|
||||||
client = boto3.client(
|
client = boto3.client(
|
||||||
"s3",
|
"s3",
|
||||||
|
config=Config(signature_version="v4"),
|
||||||
aws_access_key_id=access_key,
|
aws_access_key_id=access_key,
|
||||||
aws_secret_access_key=secret_key,
|
aws_secret_access_key=secret_key,
|
||||||
endpoint_url=endpoint,
|
endpoint_url=endpoint,
|
||||||
|
|||||||
Reference in New Issue
Block a user