diff --git a/pic-sure-resources/pic-sure-passthrough-resource/src/main/java/edu/harvard/hms/dbmi/avillach/resource/passthru/PassThroughResourceRS.java b/pic-sure-resources/pic-sure-passthrough-resource/src/main/java/edu/harvard/hms/dbmi/avillach/resource/passthru/PassThroughResourceRS.java index e251a759..84f3b282 100644 --- a/pic-sure-resources/pic-sure-passthrough-resource/src/main/java/edu/harvard/hms/dbmi/avillach/resource/passthru/PassThroughResourceRS.java +++ b/pic-sure-resources/pic-sure-passthrough-resource/src/main/java/edu/harvard/hms/dbmi/avillach/resource/passthru/PassThroughResourceRS.java @@ -5,8 +5,10 @@ import javax.inject.Inject; import javax.ws.rs.*; +import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.Response; +import javax.ws.rs.core.SecurityContext; import org.apache.http.Header; import org.apache.http.HttpResponse; @@ -85,7 +87,7 @@ public ResourceInfo info(QueryRequest infoRequest) { @POST @Path("/query") - public QueryStatus query(QueryRequest queryRequest) { + public QueryStatus query(QueryRequest queryRequest, @Context SecurityContext context) { if (queryRequest == null) { throw new ProtocolException(ProtocolException.MISSING_DATA); } @@ -102,6 +104,7 @@ public QueryStatus query(QueryRequest queryRequest) { chainRequest.setResourceCredentials(queryRequest.getResourceCredentials()); chainRequest.setResourceUUID(UUID.fromString(properties.getTargetResourceId())); chainRequest.setCommonAreaUUID(queryRequest.getCommonAreaUUID()); + chainRequest.setInstitutionOfOrigin(context.getUserPrincipal().getName()); String payload = objectMapper.writeValueAsString(chainRequest); HttpResponse response = httpClient.retrievePostResponse( diff --git a/pic-sure-resources/pic-sure-resource-api/src/main/java/edu/harvard/dbmi/avillach/domain/QueryRequest.java b/pic-sure-resources/pic-sure-resource-api/src/main/java/edu/harvard/dbmi/avillach/domain/QueryRequest.java index 5b7b7228..3a8ee942 100644 --- a/pic-sure-resources/pic-sure-resource-api/src/main/java/edu/harvard/dbmi/avillach/domain/QueryRequest.java +++ b/pic-sure-resources/pic-sure-resource-api/src/main/java/edu/harvard/dbmi/avillach/domain/QueryRequest.java @@ -56,6 +56,9 @@ public class QueryRequest { @Schema(hidden = true) private UUID commonAreaUUID; + @Schema(hidden = true) + private String institutionOfOrigin; + public Map getResourceCredentials() { return resourceCredentials; } @@ -87,4 +90,12 @@ public UUID getCommonAreaUUID() { public void setCommonAreaUUID(UUID commonAreaUUID) { this.commonAreaUUID = commonAreaUUID; } + + public String getInstitutionOfOrigin() { + return institutionOfOrigin; + } + + public void setInstitutionOfOrigin(String institutionOfOrigin) { + this.institutionOfOrigin = institutionOfOrigin; + } }