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

Added Globus-Auth as an identity provider #1

Closed
wants to merge 1 commit into from

Conversation

NickolausDS
Copy link
Owner

No description provided.

return user_info


def get_user_id(remote, email):
Copy link
Owner Author

Choose a reason for hiding this comment

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

Invenio binds user ids to usernames, so the Globus ID is also needed. This results in this second required call. The information is stored within the id token, but one of the advantages to hitting the REST APIs directly in this case is we don't require any other dependencies to look inside the OIDC token or the Globus API.

Choose a reason for hiding this comment

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

Is it potentially problematic that Globus Auth explicitly states that the mapping between identity username and ID is not fixed over time?
https://docs.globus.org/api/auth/reference/#get_v2_api_identities_usernames_lt_list_of_identity_names_gt

Choose a reason for hiding this comment

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

Also, are we guaranteed to get the primary identity at index zero of the list from v2/api/identities? it's not clear from the doc that order is guaranteed. It may be possible for a Globus Auth user to have more than one identity that uses the same email address, in which case, I'm not sure that this get_user_id function necessarily returns what we want.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I didn't think it was possible for one identity username to map to multiple ids. The example shows calling in with multiple identity usernames and returning a bunch of corresponding ids to those usernames.

For mapping identity usernames to IDs? That's a good question. If the identity username were to change hands, would the ID also change to something else thereby invalidating the user account on Invenio? Something I'm trying to confirm is that users in Invenio are tracked by external provider id rather than by username.

globus=globus.REMOTE_APP,
),
GLOBUS_APP_CREDENTIALS=GLOBUS_APP_CREDENTIALS,
DEBUG=True,

Choose a reason for hiding this comment

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

Do we want DEBUG=True in general? Or is this leftover from development?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I mostly followed the examples from all the other apps, which all set DEBUG to True.

SECURITY_PASSWORD_SALT='security-password-salt',
MAIL_SUPPRESS_SEND=True,
TESTING=True,
USERPROFILES_EXTEND_SECURITY_FORMS=True,
Copy link
Owner Author

Choose a reason for hiding this comment

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

A couple notes on Config options.

  • Mail throws an error when a user logs in due to a bug in Flask-Security. However, Invenio is aware of the problem here. It's probably better to apply the fix in one of the dependent packages instead to avoid duplication.
  • MAIL_SUPPRESS_SEND also throws an error if it's set to False. This happens very rarely for logged in users and is probably better handled in downstream packages. I'm not completely sure why editing this value results in an error, but it seemed to be a caching error here
  • SQLALCHEMY_TRACK_MODIFICATIONS throws a bunch of warnings, but should also probably be left to dependent packages to configure for themselves. We could set this in tests to squelch the warning messages on tests.


SPHINX-START

1. Register a Globus application at `https://developers.globus.org/` with the

Choose a reason for hiding this comment

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

Add reference to the app registration instructions

Copy link
Owner Author

Choose a reason for hiding this comment

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

There is a link on line 32, should it be more obvious?

Choose a reason for hiding this comment

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

I think it's better to reference the app registration portion directly by adding the #register-app to the URL. More broadly, we should think about whether this is really just a developer activity. Deploying something like Invenio is a sys admin task.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Good point, I added links to those specific sections

consumer_secret='changeme',
)

2. Register a Globus application at `https://developers.globus.org/` with the

Choose a reason for hiding this comment

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

Same here, reference the registration portion of the docs.

@@ -88,6 +94,7 @@ def base_app(request):
DEBUG=False,
SECRET_KEY='TEST',
SECURITY_DEPRECATED_PASSWORD_SCHEMES=[],
SQLALCHEMY_TRACK_MODIFICATIONS=False,
Copy link
Owner Author

Choose a reason for hiding this comment

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

I should note that this isn't part of Globus Auth, but tracking modifications in tests isn't needed and setting this variable prevents a large number of warnings produced every time a test is run.

@ericblau
Copy link

Looks good to me, now.

* Globus Login work for any provider Globus Auth supports
* Added tests, coverage of new code is 100%
* Added Sphinx docs
@NickolausDS
Copy link
Owner Author

I went ahead and rebased on the latest upstream changes and squashed the commits into one, along with a few descriptive bullet points. This should be good to go.

@NickolausDS
Copy link
Owner Author

@ericblau @rpwagner @lukaszlacinski Closing this PR and opening up the official one. Thanks for all your feedback!

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.

3 participants