jupyterhub / oauthenticator

OAuth + JupyterHub Authenticator = OAuthenticator
https://oauthenticator.readthedocs.io
BSD 3-Clause "New" or "Revised" License
413 stars 365 forks source link

Add ORCID iD Authenticator #655

Closed matthewwiese closed 1 year ago

matthewwiese commented 1 year ago

This PR adds an ORCID iD authenticator class inheriting from OAuthenticator, based on the implementation of the GitHubOAuthenticator class.

The tests are rudimentary - I'm happy to implement suggestions from maintainers.

This ought to resolve #284

welcome[bot] commented 1 year ago

Thanks for submitting your first pull request! You are awesome! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please make sure you followed the pull request template, as this will help us review your contribution more quickly. welcome You can meet the other Jovyans by joining our Discourse forum. There is also a intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

manics commented 1 year ago

Hi! We'd like to avoid adding more single service authenticators due to the maintenance and testing burden. Is there anything in here that can't be done by configuring the GenericAuthenticator?

matthewwiese commented 1 year ago

Hi! We'd like to avoid adding more single service authenticators due to the maintenance and testing burden. Is there anything in here that can't be done by configuring the GenericAuthenticator?

Nope!

Should a code snippet using GenericAuthenticator be added to the docs? As it stands, #284 remains open without a usable example, and ORCID is popular enough that I imagine you'll be getting questions related to it in the future.

Edit: There is the normalize_username() override I did have to add, as by default it would lowercase 0000-0002-9079-593X to 0000-0002-9079-593x which is not strictly-speaking correct for ORCID iDs.

manics commented 1 year ago

A documentation PR would be great!

Is it necessary to keep the upper case X? These are JupyterHub usernames so the requirement is a one-to-one mapping from the ORCID username to the JupyterHub username. Are ORCID usernames case sensitive?

In general you can't rely on going from the JupyterHub username back to the original username as downstream authenticators/spawners may need to manipulate it in other ways

matthewwiese commented 1 year ago

Closing this PR.

A documentation PR would be great!

I can do this. @manics: to what page(s) should this be added?

Are ORCID usernames case sensitive?

At least according to my reading of this page, the capital "X" is necessary for recognizing the decimal value of 10 for the checksum.

In general you can't rely on going from the JupyterHub username back to the original username as downstream authenticators/spawners may need to manipulate it in other ways

That's good to know, thank you. If at some point my use case needs the username to map 1-to-1 then I will use the custom authenticator, otherwise GenericOAuthenticator works just fine.

manics commented 1 year ago

@matthewwiese There's a page with example configurations:

But there's always room for improving the docs, so let us know if you think there's a better way to present this.