Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE-163 end support of googleServiceAccount field #125

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the shouldFetchUserServiceAccount method also be removed from DrsProviderInterface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eventually, yes. There is a bunch more to remove too.

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
Loading