RunFMe 2025-08-29 12:00:11 +03:00 zatwierdzone przez GitHub
commit ad9eb47ae3
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 23 dodań i 8 usunięć

Wyświetl plik

@ -371,13 +371,27 @@ public class S3ProxyHandler {
BlobStore blobStore;
String requestIdentity = null;
String headerAuthorization = request.getHeader(
HttpHeaders.AUTHORIZATION);
S3AuthorizationHeader authHeader = null;
boolean presignedUrl = false;
boolean headerAuth = true;
if (!anonymousIdentity) {
//try login with auth header
String headerAuthorization = request.getHeader(HttpHeaders.AUTHORIZATION);
if (Strings.isNullOrEmpty(headerAuthorization)) {
headerAuth = false;
} else {
try {
authHeader = new S3AuthorizationHeader(headerAuthorization);
//whether v2 or v4 (normal header and query)
} catch (IllegalArgumentException iae) {
headerAuth = false;
}
}
//try login as pre signed url if header failed
if (!headerAuth) {
String algorithm = request.getParameter("X-Amz-Algorithm");
if (algorithm == null) { //v2 query
String identity = request.getParameter("AWSAccessKeyId");
@ -407,14 +421,15 @@ public class S3ProxyHandler {
throw new IllegalArgumentException("unknown algorithm: " +
algorithm);
}
try {
authHeader = new S3AuthorizationHeader(headerAuthorization);
//whether v2 or v4 (normal header and query)
} catch (IllegalArgumentException iae) {
throw new S3Exception(S3ErrorCode.INVALID_ARGUMENT, iae);
}
}
try {
authHeader = new S3AuthorizationHeader(headerAuthorization);
//whether v2 or v4 (normal header and query)
} catch (IllegalArgumentException iae) {
throw new S3Exception(S3ErrorCode.INVALID_ARGUMENT, iae);
}
requestIdentity = authHeader.getIdentity();
}