Skip to content

Commit

Permalink
inst of origin
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Sikina committed Oct 7, 2023
1 parent 3babb26 commit 90507a5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ public class QueryRequest {
@Schema(hidden = true)
private UUID commonAreaUUID;

@Schema(hidden = true)
private String institutionOfOrigin;

public Map<String, String> getResourceCredentials() {
return resourceCredentials;
}
Expand Down Expand Up @@ -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;
}
}

0 comments on commit 90507a5

Please sign in to comment.