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

Public ORCID login is available. #7025

Merged
merged 10 commits into from
Jul 20, 2020
Merged

Conversation

felker13
Copy link
Contributor

@felker13 felker13 commented Jun 26, 2020

What this PR does / why we need it: This change will make it possible to use orcid public api for orcid authentication. Using member api is still possible, the chosen method depends on the userEndpoint parameter provided in the uploaded json. This feature is also mentioned in #6329.

Which issue(s) this PR closes: none

Special notes for your reviewer: none

Suggestions on how to test this: Use the new orcid-public.json with your ORCID public api credentials to create a new login option. Using the new option you should be able to log in to Dataverse using your ORCID credentials.

Does this PR introduce a user interface change? If mockups are available, please link/include them here: no

Is there a release notes update needed for this change?: This should be included in the release notes as a new feature.

Additional documentation: none

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

@felker13 this is very exciting! Would you be able to make any necessary changes to the OAuth section of the Installation guide?

In particular, if it's no longer (or never was) true that ORCID requires institutions to pay to use their login service, we should change this line:

"ORCID and Microsoft, on the other hand, do not have an automated system for requesting these credentials, and it is not free to use these authentication services."

I'm highlighting it in blue below:

Screen Shot 2020-06-26 at 10 29 40 AM

It's from this page: http://guides.dataverse.org/en/4.20/installation/oauth2.html

Here's the source: https://github.com/IQSS/dataverse/blob/develop/doc/sphinx-guides/source/installation/oauth2.rst

Would you be able to make this change?

The code seems fine. I assume one chooses between public and non-public using the userEndpoint part of factoryData.

@felker13
Copy link
Contributor Author

felker13 commented Jun 26, 2020 via email

@coveralls
Copy link

coveralls commented Jun 29, 2020

Coverage Status

Coverage increased (+0.002%) to 19.655% when pulling 298bfab on dsd-sztaki-hu:orcid-public-api into 6daf219 on IQSS:develop.

@pdurbin pdurbin self-assigned this Jun 29, 2020
@pdurbin
Copy link
Member

pdurbin commented Jun 29, 2020

@felker13 I made a pull request to change the docs at dsd-sztaki-hu#1

Please take a look. Thanks.

@pdurbin pdurbin removed their assignment Jun 29, 2020
remove cost, link to ORCID APIs public, member IQSS#7025
@felker13
Copy link
Contributor Author

@pdurbin I agree with your suggestions, so I merged your changes. Thank you.

Copy link
Member

@pdurbin pdurbin left a comment

Choose a reason for hiding this comment

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

This looks good but I haven't tested it.

The idea is to add a second ORCID login option that uses's ORCID's public API. The older option that uses the member API should continue to work.

@djbrooke
Copy link
Contributor

Hi @felker13 - can you include a screenshot of this? I wasn't aware that this may have impact to the UI. If it's in the way I understand it above, I'm hesitant to provide multiple options for ORCID login, as it may confuse people. Also, are there other applications that have these multiple options implemented in the same way? If so, can you point us to some of these platforms? Thank you!

@pdurbin
Copy link
Member

pdurbin commented Jun 30, 2020

@djbrooke there would not be multiple ORCID logins. What is being provided is more flexibility for the sysadmin who is configuring Dataverse. Basically, if you're institution is already a member of ORCID (like Harvard), you use the ORCID member API we've always supported. If your institution is not a member of ORCID, you use ORCID's public API.

@djbrooke
Copy link
Contributor

@pdurbin thanks, so the decision about which login option to use would be made at the installation level, not at the researcher level. Makes sense, perfect.

@felker13 I am going to keep this assigned to you. Can you please update the top comment of the PR to match the pull request template format in other PRs (like in #7039)? It will help us test and get this merged. Thank you!

Copy link
Contributor

@poikilotherm poikilotherm left a comment

Choose a reason for hiding this comment

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

Overall this is a very good idea for a very simple approach, following "convention over configuration".

A unit test case at OrcidOAuth2APTest is missing for this and should be done before merging to enhance code coverage. Happy to help if wanted.


URLs to help you request a Client ID and Client Secret from the providers supported by Dataverse are provided below. For all of these providers, it's a good idea to request the Client ID and Client secret using a generic account, perhaps the one that's associated with the ``:SystemEmail`` you've configured for Dataverse, rather than your own personal Microsoft Azure AD, ORCID, GitHub, or Google account:

- ORCID: https://orcid.org/content/register-client-application-production-trusted-party
- ORCID: https://orcid.org/content/register-client-application-0
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- ORCID: https://orcid.org/content/register-client-application-0
- ORCID: https://orcid.org/content/register-client-application

Copy link
Member

Choose a reason for hiding this comment

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

Can you please update the top comment of the PR to match the pull request template format in other PRs

This done so I'm moving this to code review.

Copy link
Member

Choose a reason for hiding this comment

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

Interesting. I got the longer link with the "-0" at the end from https://orcid.org/organizations/integrators but I do think the shorter link looks nicer (and goes to the same place) so it would be a good change. @felker13 I don't have access to accept this change.

Comment on lines 59 to 63
String s = null;
if(userEndpoint != null){
s = userEndpoint.startsWith("https://pub") ? "/authenticate" : "/read-limited";
}
scope = Arrays.asList(s);
Copy link
Contributor

Choose a reason for hiding this comment

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

One could argue that this can be done more compact with only one if and without an extra variable allocation.

E. g. like

if(userEndpoint != null && userEndpoint.startsWith("https://pub")) {
    this.scope = Arrays.asList("/authenticate");
} else {
    this.scope = Arrays.asList("/read-limited");
}

Or you leave it to the code optimizer of the JVM... 😉

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with letting the JVM optimize it. 😄

@pdurbin
Copy link
Member

pdurbin commented Jul 2, 2020

@felker13 can you please create an issue for this pull request to close? It can be short. Just a title and a one line description is fine. Thanks!

@pdurbin
Copy link
Member

pdurbin commented Jul 2, 2020

A unit test case at OrcidOAuth2APTest is missing for this and should be done before merging to enhance code coverage. Happy to help if wanted.

@poikilotherm as we discussed at http://irclog.iq.harvard.edu/dataverse/2020-07-02#i_125994 you are welcome to write the extra unit tests either before or after this pull request is merged. Thanks for offering!

poikilotherm added a commit to poikilotherm/dataverse that referenced this pull request Jul 8, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this pull request Jul 8, 2020
poikilotherm added a commit to poikilotherm/dataverse that referenced this pull request Jul 8, 2020
@poikilotherm
Copy link
Contributor

@pdurbin @felker13 I just created dsd-sztaki-hu#2, merging latest develop and unit tests for this.

@pdurbin
Copy link
Member

pdurbin commented Jul 8, 2020

@poikilotherm thanks. Is it possible to make the diff smaller? I assume to do so one would merge the latest from develop into dsd-sztaki-hu:orcid-public-api (this pull request).

@poikilotherm
Copy link
Contributor

@pdurbin yeah, that should make the diff much smaller...

@kcondon kcondon self-assigned this Jul 9, 2020
@kcondon kcondon merged commit f5104d1 into IQSS:develop Jul 20, 2020
@djbrooke djbrooke added this to the Dataverse 5 milestone Jul 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants