Skip to content

Commit f965ba4

Browse files
committed
Merge branch 'develop' into 11968-compare-versions-license
2 parents 0ab4864 + fadbfdd commit f965ba4

8 files changed

Lines changed: 91 additions & 144 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Bug / Not Bug in Dataverse. Bug is in SPA Frontend
2+
3+
Cleaned up Access APIs to localize getting user from session for JSF backward compatibility
4+
5+
This bug requires a front end fix to send the Bearer Token in the API call.
6+
7+
See: #11740
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
In prior versions of Dataverse, configuring a proxy to forward to Dataverse over an http connection could result in failure of signed Urls (e.g. for external tools). This version of Dataverse supports having a proxy send an X-Forwarded-Proto header set to https to avoid this issue.

doc/sphinx-guides/source/api/external-tools.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ The signed URL mechanism is more secure than exposing API tokens and therefore r
174174
- For tools invoked via a GET call, Dataverse will include a callback query parameter with a Base64 encoded value. The decoded value is a signed URL that can be called to retrieve a JSON response containing all of the queryParameters and allowedApiCalls specified in the manfiest.
175175
- For tools invoked via POST, Dataverse will send a JSON body including the requested queryParameters and allowedApiCalls. Dataverse expects the response to the POST to indicate a redirect which Dataverse will use to open the tool.
176176

177+
.. note::
178+
179+
**For Dataverse site administrators:** When Dataverse is behind a proxy, signed URLs may not work correctly due to protocol mismatches (HTTP vs HTTPS). Please refer to the :ref:`signed-urls-forwarded-proto-header` section to ensure signed URLs work properly in proxy environments.
180+
177181
API Token
178182
^^^^^^^^^
179183

doc/sphinx-guides/source/installation/config.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ First of all, confirm that access is denied! If you are in fact able to access t
9494

9595
Still feel like activating this option in your configuration? - Have fun and be safe!
9696

97+
.. _signed-urls-forwarded-proto-header:
98+
99+
Using X-Forwarded-Proto for Signed URLs
100+
+++++++++++++++++++++++++++++++++++++++
101+
102+
If you use a proxy such as Apache or Nginx, or have a firewall such as Anubis, and they are configured to forward traffic to Dataverse over HTTP
103+
(i.e. your proxy receives user calls over HTTPS but forwards locally to Dataverse over HTTP), signed URLs, used by external tools and
104+
upload apps (such as DVWebloader), are likely to fail unless you configure your proxy to send an X-Forwarded-Proto HTTP Header.
105+
This allows Dataverse to recognize that the communication from the user was over HTTPS and that validation of signed URLs should assume
106+
they started with https:// (rather than http:// as received from the proxy).
97107

98108
.. _PrivacyConsiderations:
99109

src/main/java/edu/harvard/iq/dataverse/Dataverse.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,16 @@ public List<DataverseFeaturedDataverse> getDataverseFeaturingDataverses() {
243243
public void setDataverseFeaturingDataverses(List<DataverseFeaturedDataverse> dataverseFeaturingDataverses) {
244244
this.dataverseFeaturingDataverses = dataverseFeaturingDataverses;
245245
}
246-
246+
247+
@OneToMany(mappedBy = "dataverse", orphanRemoval = true, cascade = {CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
248+
private List<Metric> dataverseMetrics = new ArrayList<>();
249+
public List<Metric> getDataverseMetrics() {
250+
return dataverseMetrics;
251+
}
252+
public void setDataverseMetrics(List<Metric> dataverseMetrics) {
253+
this.dataverseMetrics = dataverseMetrics;
254+
}
255+
247256
@OneToMany(mappedBy="dataverse", cascade={CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST})
248257
private List<DataverseLinkingDataverse> dataverseLinkingDataverses;
249258

src/main/java/edu/harvard/iq/dataverse/GuestbookResponseServiceBean.java

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -770,49 +770,17 @@ private void initCustomQuestions(GuestbookResponse guestbookResponse, Dataset da
770770
}
771771
}
772772

773-
private void setUserDefaultResponses(GuestbookResponse guestbookResponse, DataverseSession session, User userIn) {
774-
User user;
775-
User sessionUser = session.getUser();
776-
777-
if (userIn != null){
778-
user = userIn;
779-
} else{
780-
user = sessionUser;
781-
}
782-
783-
if (user != null) {
784-
guestbookResponse.setEmail(getUserEMail(user));
785-
guestbookResponse.setName(getUserName(user));
786-
guestbookResponse.setInstitution(getUserInstitution(user));
787-
guestbookResponse.setPosition(getUserPosition(user));
788-
guestbookResponse.setAuthenticatedUser(getAuthenticatedUser(user));
789-
} else {
790-
guestbookResponse.setEmail("");
791-
guestbookResponse.setName("");
792-
guestbookResponse.setInstitution("");
793-
guestbookResponse.setPosition("");
794-
guestbookResponse.setAuthenticatedUser(null);
795-
}
796-
guestbookResponse.setSessionId(session.toString());
773+
private void setUserDefaultResponses(GuestbookResponse guestbookResponse, DataverseSession session, User user) {
774+
guestbookResponse.setEmail(getUserEMail(user));
775+
guestbookResponse.setName(getUserName(user));
776+
guestbookResponse.setInstitution(getUserInstitution(user));
777+
guestbookResponse.setPosition(getUserPosition(user));
778+
guestbookResponse.setAuthenticatedUser(getAuthenticatedUser(user));
779+
guestbookResponse.setSessionId(session != null ? session.toString() : "");
797780
}
798781

799782
private void setUserDefaultResponses(GuestbookResponse guestbookResponse, DataverseSession session) {
800-
User user = session.getUser();
801-
802-
if (user != null) {
803-
guestbookResponse.setEmail(getUserEMail(user));
804-
guestbookResponse.setName(getUserName(user));
805-
guestbookResponse.setInstitution(getUserInstitution(user));
806-
guestbookResponse.setPosition(getUserPosition(user));
807-
guestbookResponse.setAuthenticatedUser(getAuthenticatedUser(user));
808-
} else {
809-
guestbookResponse.setEmail("");
810-
guestbookResponse.setName("");
811-
guestbookResponse.setInstitution("");
812-
guestbookResponse.setPosition("");
813-
guestbookResponse.setAuthenticatedUser(null);
814-
}
815-
guestbookResponse.setSessionId(session.toString());
783+
setUserDefaultResponses(guestbookResponse, session, session.getUser());
816784
}
817785

818786
public GuestbookResponse initDefaultGuestbookResponse(Dataset dataset, DataFile dataFile, DataverseSession session) {

0 commit comments

Comments
 (0)