Skip to content

Commit

Permalink
end support of googleServiceAccount field
Browse files Browse the repository at this point in the history
  • Loading branch information
dvoet committed Nov 20, 2024
1 parent a7e42ef commit 2b74d9e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ private DrsMetadata fetchObject(
var accessMethod = AccessMethodUtils.getAccessMethod(drsResponse, drsProvider, cloudPlatform);
var accessMethodType = accessMethod.map(AccessMethod::getType).orElse(null);

if (drsProvider.shouldFetchUserServiceAccount(accessMethodType, requestedFields)) {
var saKey = authService.fetchUserServiceAccount(drsProvider, bearerToken);
drsMetadataBuilder.bondSaKey(saKey);
}

if (drsResponse != null) {
drsMetadataBuilder.drsResponse(drsResponse);
setDrsResponseValues(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

import bio.terra.drshub.BaseTest;
import bio.terra.drshub.generated.model.SaKeyObject;
import bio.terra.drshub.models.DrsApi;
import bio.terra.drshub.models.Fields;
import bio.terra.drshub.services.AuthService;
Expand Down Expand Up @@ -222,45 +221,6 @@ void testDoesNotCallEcmWhenOnlyDrsFieldsRequested() throws Exception {
verify(externalCredsApiFactory, times(0)).getApi(any());
}

@Test
void testDrsProviderDoesNotSupportGoogle() throws Exception {
var cidProviderHost = getProviderHosts("kidsFirst");

postDrsHubRequest(
TEST_ACCESS_TOKEN,
cidProviderHost.compactUriPrefix(),
UUID.randomUUID().toString(),
List.of(Fields.GOOGLE_SERVICE_ACCOUNT))
.andExpect(status().isOk())
.andExpect(content().json("{}"));
}

@Test
void testDrsProviderDoesSupportGoogle() throws Exception {
var cidProviderHost = getProviderHosts("bioDataCatalyst");

Map<String, Object> fenceAccountKey = new HashMap<>();
fenceAccountKey.put("foo", "sa key");
ObjectMapper mapper = new ObjectMapper();
mockExternalCredsFenceAccountKeyApi(
Provider.fromValue(cidProviderHost.drsProvider().getEcmFenceProvider().get().getUriValue()),
TEST_ACCESS_TOKEN,
mapper.writeValueAsString(fenceAccountKey));

var saKeyObject = new SaKeyObject().data(fenceAccountKey);
postDrsHubRequest(
TEST_ACCESS_TOKEN,
cidProviderHost.compactUriPrefix(),
UUID.randomUUID().toString(),
List.of(Fields.GOOGLE_SERVICE_ACCOUNT))
.andExpect(status().isOk())
.andExpect(
content()
.json(
objectMapper.writeValueAsString(
Map.of(Fields.GOOGLE_SERVICE_ACCOUNT, saKeyObject))));
}

@Test
void testCallsCorrectEndpointsWhenOnlyAccessUrlRequested() throws Exception {
var cidProviderHost = getProviderHosts("kidsFirst");
Expand Down

0 comments on commit 2b74d9e

Please sign in to comment.