Commit bfffd084 authored by Erik Leckner's avatar Erik Leckner
Browse files

file-azure

parent 424a8143
Pipeline #6391 passed with stage
in 4 minutes and 29 seconds
...@@ -22,6 +22,8 @@ import java.net.URI; ...@@ -22,6 +22,8 @@ import java.net.URI;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.opengroup.osdu.file.model.SignedObject; import org.opengroup.osdu.file.model.SignedObject;
...@@ -30,7 +32,6 @@ import org.opengroup.osdu.file.provider.azure.storage.BlobId; ...@@ -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.BlobInfo;
import org.opengroup.osdu.file.provider.azure.storage.Storage; import org.opengroup.osdu.file.provider.azure.storage.Storage;
import org.opengroup.osdu.file.provider.interfaces.IStorageRepository; import org.opengroup.osdu.file.provider.interfaces.IStorageRepository;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.web.util.UriUtils; import org.springframework.web.util.UriUtils;
......
...@@ -67,7 +67,8 @@ public class AzureTokenServiceImpl { ...@@ -67,7 +67,8 @@ public class AzureTokenServiceImpl {
.endpoint(blobUrl) .endpoint(blobUrl)
.buildClient(); .buildClient();
OffsetDateTime expires = calcTokenExpirationDate(duration, timeUnit); 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"); BlobSasPermission permissions = BlobSasPermission.parse("crw");
BlobServiceSasSignatureValues tokenProps = new BlobServiceSasSignatureValues(expires, permissions); BlobServiceSasSignatureValues tokenProps = new BlobServiceSasSignatureValues(expires, permissions);
String sasToken = tokenSource.generateUserDelegationSas(tokenProps, key); String sasToken = tokenSource.generateUserDelegationSas(tokenProps, key);
......
...@@ -35,7 +35,6 @@ import com.azure.identity.ClientSecretCredentialBuilder; ...@@ -35,7 +35,6 @@ import com.azure.identity.ClientSecretCredentialBuilder;
import com.azure.storage.blob.BlobContainerClient; import com.azure.storage.blob.BlobContainerClient;
import com.azure.storage.blob.BlobContainerClientBuilder; import com.azure.storage.blob.BlobContainerClientBuilder;
import com.azure.storage.blob.BlobUrlParts; import com.azure.storage.blob.BlobUrlParts;
import com.azure.storage.blob.specialized.BlockBlobClient;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.opengroup.osdu.file.provider.azure.common.base.MoreObjects; import org.opengroup.osdu.file.provider.azure.common.base.MoreObjects;
...@@ -44,7 +43,6 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -44,7 +43,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.inject.Inject; import javax.inject.Inject;
import java.io.ByteArrayInputStream;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; 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