Commit 3eb588c1 authored by Erik Leckner's avatar Erik Leckner
Browse files

file-azure

parent f9140d3a
......@@ -22,6 +22,8 @@ import java.net.URI;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils;
import org.opengroup.osdu.file.model.SignedObject;
......@@ -30,7 +32,6 @@ import org.opengroup.osdu.file.provider.azure.storage.BlobId;
import org.opengroup.osdu.file.provider.azure.storage.BlobInfo;
import org.opengroup.osdu.file.provider.azure.storage.Storage;
import org.opengroup.osdu.file.provider.interfaces.IStorageRepository;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Repository;
import org.springframework.web.util.UriUtils;
......
......@@ -67,7 +67,8 @@ public class AzureTokenServiceImpl {
.endpoint(blobUrl)
.buildClient();
OffsetDateTime expires = calcTokenExpirationDate(duration, timeUnit);
UserDelegationKey key = rbacKeySource.getUserDelegationKey(null, expires);
UserDelegationKey key = rbacKeySource.getUserDelegationKey(OffsetDateTime.now(ZoneOffset.UTC).minusMinutes(1), expires);
BlobSasPermission permissions = BlobSasPermission.parse("crw");
BlobServiceSasSignatureValues tokenProps = new BlobServiceSasSignatureValues(expires, permissions);
String sasToken = tokenSource.generateUserDelegationSas(tokenProps, key);
......
......@@ -35,7 +35,6 @@ import com.azure.identity.ClientSecretCredentialBuilder;
import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.BlobContainerClientBuilder;
import com.azure.storage.blob.BlobUrlParts;
import com.azure.storage.blob.specialized.BlockBlobClient;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.opengroup.osdu.file.provider.azure.common.base.MoreObjects;
......@@ -44,7 +43,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import java.io.ByteArrayInputStream;
import java.net.MalformedURLException;
import java.net.URL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment