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

client: add logout blueprint #304

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

jrcastro2
Copy link
Contributor

@jrcastro2 jrcastro2 force-pushed the add-logout-blueprint branch 2 times, most recently from b050e25 to bb41165 Compare May 30, 2023 07:58
invenio_oauthclient/views/client.py Outdated Show resolved Hide resolved

# We set the remote in the session to be aware of which one is being used and, on log out redirect to
# the correct URL set in the OAUTHCLIENT_REMOTE_APPS for each remote
session["remote_name"] = remote.name
Copy link
Contributor

Choose a reason for hiding this comment

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

does it make sense to namespace this, with a prefix?
See for example current_app.config["OAUTHCLIENT_SESSION_KEY_PREFIX"], I don't know if it makes much sense.

Copy link
Member

Choose a reason for hiding this comment

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

Agree on this one... Also, what happens e.g. when you connect multiple OAuth providers to your account? Would it be only the last one that ends up in the session variable? Would it make sense to keep a list/set of remotes like so:

session.setdefault("remote_names", set())  # not sure if set is supported
session["remote_name"].add(remote.name)

Then you could in logout check which of the remotes has a logout_url specified and again make an arbitrary choice, e.g. the first one...

This sounds a bit overcomplicated, and I'm not sure if it makes perfect sense though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Prefixed as requested.
I am not sure if multiple accounts connected affects this, the remote_name is set on loging and although your account might be connected to multiple OAuth providers you always log in with only one of the, or am I wrong?

However, if I am wrong, looks to me that could be done in another issue as an improvement (?)

invenio_oauthclient/views/client.py Outdated Show resolved Hide resolved
Copy link
Member

@slint slint left a comment

Choose a reason for hiding this comment

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

Minor comments, but not 100% sure on the specifics of the end use-case.

@@ -271,3 +271,19 @@ def rest_disconnect(remote_app):
return _disconnect(remote_app)
except OAuthRemoteNotFound:
abort(404)


@blueprint.route("/logout")
Copy link
Member

Choose a reason for hiding this comment

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

minor: does it make sense to also have a REST API version, i.e. under rest_blueprint, for this view similar to the others above?

Copy link
Contributor Author

@jrcastro2 jrcastro2 Jun 19, 2023

Choose a reason for hiding this comment

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

If we decide to got for this I think we should split between logout_url´ and rest_logout_url` because I guess while using the rest you would like to redirect to rest endpoint as well ?

I think this could be done as an improvement, WDYT?

Copy link
Contributor

@kpsherva kpsherva Jun 20, 2023

Choose a reason for hiding this comment

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

lets do as an improvement and ship this one ( I have already created a ticket )


# We set the remote in the session to be aware of which one is being used and, on log out redirect to
# the correct URL set in the OAUTHCLIENT_REMOTE_APPS for each remote
session["remote_name"] = remote.name
Copy link
Member

Choose a reason for hiding this comment

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

Agree on this one... Also, what happens e.g. when you connect multiple OAuth providers to your account? Would it be only the last one that ends up in the session variable? Would it make sense to keep a list/set of remotes like so:

session.setdefault("remote_names", set())  # not sure if set is supported
session["remote_name"].add(remote.name)

Then you could in logout check which of the remotes has a logout_url specified and again make an arbitrary choice, e.g. the first one...

This sounds a bit overcomplicated, and I'm not sure if it makes perfect sense though.

@jrcastro2 jrcastro2 force-pushed the add-logout-blueprint branch from bb41165 to d159d6e Compare June 19, 2023 17:26
@kpsherva kpsherva mentioned this pull request Jun 20, 2023
@kpsherva kpsherva merged commit 6bc629c into inveniosoftware:master Jun 20, 2023
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.

[DEPENDS ON #invenio-app-rdm/2186] CERN e-groups integration
4 participants